agent: UnregisterAgent on free

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) <noreply@anthropic.com>
This commit is contained in:
nemunaire 2026-04-29 11:26:25 +07:00
commit 3fc41eef8f

View file

@ -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);