wireplumber/modules
Chengyi Zhao 2e00356c98 lib: core: add prepare_shutdown vfunc to fix Lua GC crash on exit
When WirePlumber exits, it crashes with SIGABRT. The backtrace shows:

  7  g_closure_invalidate
  10 g_object_unref
  15 g_value_unset
  16 _wplua_gvalue_userdata___gc
  26 close_state (lua_close)
  27 wp_plugin_deactivate
  33 wp_registry_clear
  34 wp_core_dispose

Root cause: lua_State is referenced by both the main plugin and each
WpLuaScript object. During registry cleanup, scripts call lua_close again
on an already-destroyed state, causing use-after-free.

Fix:
- Add a prepare_shutdown vfunc in WpPlugin. Call it from wp_core_dispose
  *before* clearing the registry.
- Lua plugin implements prepare_shutdown to close its lua_State early,
  allowing all __gc finalizers to run while GObjects are still alive.
- Then clear the lua_State pointer from every WpLuaScript object via
  wp_lua_script_clear_lua_state().
- Guard WpLuaScript finalize to skip if pointer is already NULL.
2026-05-08 14:44:44 +08:00
..
module-lua-scripting lib: core: add prepare_shutdown vfunc to fix Lua GC crash on exit 2026-05-08 14:44:44 +08:00
module-reserve-device m-reserve-device: cancel get proxy callback properly 2024-11-01 20:46:54 +02:00
dbus-connection-state.h dbus: refactor WpDBus into a plugin called dbus-connection 2023-06-20 12:39:29 +03:00
flatpak-utils.h m-mpris: add MPRIS plugin 2025-07-23 10:19:44 +03:00
meson.build modules: Add notifications-api module 2025-10-01 18:04:58 +03:00
module-dbus-connection.c m-dbus-connection: Add 'plugin.name' and 'bus.system' args 2025-08-29 18:02:59 +03:00
module-default-nodes-api.c metadata: remove wp_metadata_iterator_item_extract() API 2024-02-28 08:15:17 -05:00
module-file-monitor-api.c core: change the component arguments to be WpSpaJson instead of GVariant 2023-05-25 18:29:58 +03:00
module-log-settings.c log: rename back to wp_log_set_level 2024-01-13 16:33:05 +00:00
module-logind.c Improve monitoring of seat state 2024-05-08 13:58:16 +00:00
module-mixer-api.c m-mixer-api: Fix memory in leak wp_mixer_api_set_volume 2024-09-26 14:12:18 +02:00
module-modem-manager.c m-modem-manager: Unref WpCore 2025-12-16 15:59:07 +02:00
module-mpris.c m-mpris: Check variant type directly 2025-12-23 20:05:09 +02:00
module-notifications-api.c modules: Add notifications-api module 2025-10-01 18:04:58 +03:00
module-portal-permissionstore.c portal-permissionstore: Add 3s timeout to D-Bus calls and fix Set create parameter 2026-04-22 19:39:05 +08:00
module-settings.c m-settings: remove all persistent settings if key is null 2024-03-23 09:39:45 +00:00
module-si-audio-adapter.c m-si-audio-adapter: don't overread the position array 2025-10-21 16:31:00 +02:00
module-si-node.c si-linkables: do not fully reset when the underlying proxy is destroyed 2024-03-12 12:44:32 +02:00
module-si-standard-link.c m-si-standard-link: log error message when link activation fails 2025-10-17 08:41:48 -04:00
module-standard-event-source.c m-standard-event-source: Add 'autoswitch-*' local event priority 2026-03-19 20:25:38 +02:00