shell/camera-monitor: Remove hooks before destroying objects

Otherwise removing the hook will try to unlink from a list whose
previous element belonged to the already destroyed object.

Fixes: d09d24666 ("shell: Add device monitor for cameras")
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2893>
This commit is contained in:
Sebastian Keller 2023-08-12 17:30:24 +02:00
parent 4e00c1d372
commit e7c269e014

View File

@ -297,10 +297,10 @@ shell_camera_monitor_disconnect_core (ShellCameraMonitor *monitor)
g_ptr_array_set_size (monitor->node_list, 0);
g_clear_handle_id (&monitor->delayed_disable_id, g_source_remove);
g_clear_pointer ((struct pw_proxy**) &monitor->registry, pw_proxy_destroy);
spa_hook_remove (&monitor->registry_listener);
g_clear_pointer (&monitor->core, pw_core_disconnect);
g_clear_pointer ((struct pw_proxy**) &monitor->registry, pw_proxy_destroy);
spa_hook_remove (&monitor->core_listener);
g_clear_pointer (&monitor->core, pw_core_disconnect);
}
static gboolean