From d46723132145d708db453299f29a9391815b582b Mon Sep 17 00:00:00 2001 From: Pierre-Olivier Mercier Date: Wed, 29 Apr 2026 18:26:11 +0700 Subject: [PATCH] popup: clear hidden passphrase stash on close and on radio-off The pre-armed passphrase entered through the hidden-network dialog is process-global, not popup-scoped. If the user closed the popup (or toggled Wi-Fi off) before iwd asked for it, the passphrase sat in the heap until the 30 s timer fired. Wipe it eagerly on _destroy() and when state transitions to IWD_STATE_OFF. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/e_mod_popup.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/e_mod_popup.c b/src/e_mod_popup.c index 1795959..912980c 100644 --- a/src/e_mod_popup.c +++ b/src/e_mod_popup.c @@ -292,6 +292,9 @@ _refresh(Popup *p) { if (!p || !e_iwd || !e_iwd->manager) return; Iwd_State s = iwd_manager_state(e_iwd->manager); + /* Radio went off: the stash can no longer be useful (iwd won't ask) + * and we'd rather not keep a passphrase resident across a toggle. */ + if (s == IWD_STATE_OFF) _hidden_pending_clear(); if (p->status_lbl) { const char *err = iwd_manager_last_error(e_iwd->manager); @@ -467,6 +470,10 @@ _destroy(void) if (_popup->gp) e_object_del(E_OBJECT(_popup->gp)); free(_popup); _popup = NULL; + /* Drop any pre-armed hidden-network passphrase: if the user closes the + * popup before iwd asks, the stash would otherwise sit in the heap until + * the 30 s timer fires. The stash is process-global, not popup-scoped. */ + _hidden_pending_clear(); } void