From 3fc41eef8f864fee8b8dffc5b2cb3b51d3643af3 Mon Sep 17 00:00:00 2001 From: Pierre-Olivier Mercier Date: Wed, 29 Apr 2026 11:26:25 +0700 Subject: [PATCH] agent: UnregisterAgent on free MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Tell iwd to drop our registration during shutdown instead of relying on NameOwnerChanged GC. Avoids spurious agent calls landing while the service interface is being torn down. Fire-and-forget — the reply, if any, is irrelevant. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/iwd/iwd_agent.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/iwd/iwd_agent.c b/src/iwd/iwd_agent.c index 74c67f1..f78c558 100644 --- a/src/iwd/iwd_agent.c +++ b/src/iwd/iwd_agent.c @@ -183,6 +183,13 @@ void iwd_agent_free(Iwd_Agent *a) { if (!a) return; + /* Politely deregister so iwd doesn't keep dispatching to a dead service + * during shutdown. Fire-and-forget: the connection may already be torn + * down by the time the call would land, and there's nothing to do with + * the reply anyway. */ + if (a->am_proxy) + eldbus_proxy_call(a->am_proxy, "UnregisterAgent", NULL, NULL, -1, + "o", IWD_AGENT_PATH); if (a->svc) eldbus_service_interface_unregister(a->svc); if (a->am_proxy) eldbus_proxy_unref(a->am_proxy); if (a->am_obj) eldbus_object_unref(a->am_obj);