From ce323cdaf8fecbc8e1fe8a017ae3a9fd3fae53f2 Mon Sep 17 00:00:00 2001 From: Pierre-Olivier Mercier Date: Sun, 28 Dec 2025 21:53:22 +0700 Subject: [PATCH] Fix module shutdown order to prevent signal handler double-free The shutdown sequence was freeing D-Bus resources before cleaning up devices and networks, causing devices/networks to attempt deleting already-freed signal handlers. Shutdown order fixed: 1. Gadget shutdown 2. Network shutdown (frees networks and their signal handlers) 3. Device shutdown (frees devices and their signal handlers) 4. State shutdown 5. Agent shutdown 6. D-Bus shutdown (closes connection and frees proxies) This ensures signal handlers are properly deleted while the D-Bus connection is still active, preventing the 'Eina Magic Check Failed' error during module unload. Fixes: CRI: eldbus_signal_handler_del() Magic Check Failed --- src/e_mod_main.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/e_mod_main.c b/src/e_mod_main.c index 4dd0605..cf4bbff 100644 --- a/src/e_mod_main.c +++ b/src/e_mod_main.c @@ -87,13 +87,15 @@ e_modapi_shutdown(E_Module *m EINA_UNUSED) /* Shutdown gadget */ e_iwd_gadget_shutdown(); - /* Shutdown D-Bus and iwd subsystems */ - iwd_agent_shutdown(); - iwd_dbus_shutdown(); + /* Shutdown iwd subsystems (must happen before D-Bus shutdown) */ iwd_network_shutdown(); iwd_device_shutdown(); iwd_state_shutdown(); + /* Shutdown D-Bus (this frees all proxies and handlers) */ + iwd_agent_shutdown(); + iwd_dbus_shutdown(); + /* Free configuration */ _iwd_config_free(); e_iwd_config_shutdown();