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
This commit is contained in:
nemunaire 2025-12-28 21:53:22 +07:00
commit ce323cdaf8

View file

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