fix: add destroy() and signal cleanup across widgets, fix settings window + menu regressions

P0 leak fixes: context/action menus destroyed on deactivate, config
callbacks unregistered in settings widgets, recorder and server signal
IDs stored and disconnected, bluetooth client closed and unsubscribed,
rfkill timer removed, seek timers cancelled, dropdown and options menus
freed, app name cache LRU-bounded.

Fix desktop 'Edit Widgets' and settings menu regressions by deferring
destroy out of Gtk signal handlers via GLib.idle_add.

Fix settings entry fields by connecting the activate signal explicitly
(Enter saves the value).
This commit is contained in:
sankalp committed 2026-08-01 19:44:39 +05:45
1 parent 55fc3fba21
commit d8696b9198
13 files changed
+180 -44

No files matched your search

+34 -20
View File
@@ -677,32 +677,46 @@ class BluetoothClient(Service):
None,
)
self._bus.signal_subscribe(
BLUEZ_SERVICE,
DBUS_OM_IFACE,
"InterfacesAdded",
None,
None,
Gio.DBusSignalFlags.NONE,
self._on_interfaces_added,
None,
)
self._bus.signal_subscribe(
BLUEZ_SERVICE,
DBUS_OM_IFACE,
"InterfacesRemoved",
None,
None,
Gio.DBusSignalFlags.NONE,
self._on_interfaces_removed,
None,
)
self._bus_sub_ids = [
self._bus.signal_subscribe(
BLUEZ_SERVICE,
DBUS_OM_IFACE,
"InterfacesAdded",
None,
None,
Gio.DBusSignalFlags.NONE,
self._on_interfaces_added,
None,
),
self._bus.signal_subscribe(
BLUEZ_SERVICE,
DBUS_OM_IFACE,
"InterfacesRemoved",
None,
None,
Gio.DBusSignalFlags.NONE,
self._on_interfaces_removed,
None,
),
]
self._cached_rfkill_blocked = _rfkill_soft_blocked()
self._rfkill_timeout_id = GLib.timeout_add_seconds(10, self._check_rfkill)
self._populate_from_object_manager()
def close(self):
"""Release the rfkill timer and unsubscribe from the DBus bus."""
if self._rfkill_timeout_id:
GLib.source_remove(self._rfkill_timeout_id)
self._rfkill_timeout_id = 0
for sub_id in self._bus_sub_ids:
self._bus.signal_unsubscribe(sub_id)
self._bus_sub_ids.clear()
for adapter in list(self._adapters.values()):
adapter.close()
self._adapters.clear()
def _check_rfkill(self) -> bool:
blocked = _rfkill_soft_blocked()
if blocked != self._cached_rfkill_blocked: