[mutter] remote-desktop: Close sessions on prepare-shutdown
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] remote-desktop: Close sessions on prepare-shutdown
- Date: Tue, 11 May 2021 17:10:03 +0000 (UTC)
commit 4a057535e7ffab0c3be4c5dead92643da9a3d7e0
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Wed May 5 14:22:18 2021 +0200
remote-desktop: Close sessions on prepare-shutdown
When finalizing, the MetaDisplay instance will already be gone, so to be
able to gracefully tear down the clipboard integration, make sure to
close sessions before the display is closed, i.e. on prepare-shutdown.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1853>
src/backends/meta-remote-desktop.c | 26 ++++++++++++++++++++++----
1 file changed, 22 insertions(+), 4 deletions(-)
---
diff --git a/src/backends/meta-remote-desktop.c b/src/backends/meta-remote-desktop.c
index 0c9d4f0ad7..f0a4998184 100644
--- a/src/backends/meta-remote-desktop.c
+++ b/src/backends/meta-remote-desktop.c
@@ -249,18 +249,32 @@ meta_remote_desktop_constructed (GObject *object)
NULL);
}
+static void
+on_prepare_shutdown (MetaBackend *backend,
+ MetaRemoteDesktop *remote_desktop)
+{
+ GHashTableIter iter;
+ gpointer value;
+
+ g_hash_table_iter_init (&iter, remote_desktop->sessions);
+ while (g_hash_table_iter_next (&iter, NULL, &value))
+ {
+ MetaRemoteDesktopSession *session = value;
+
+ g_hash_table_iter_steal (&iter);
+ meta_remote_desktop_session_close (session);
+ }
+}
+
static void
meta_remote_desktop_finalize (GObject *object)
{
MetaRemoteDesktop *remote_desktop = META_REMOTE_DESKTOP (object);
- GList *sessions;
if (remote_desktop->dbus_name_id != 0)
g_bus_unown_name (remote_desktop->dbus_name_id);
- sessions = g_list_copy (g_hash_table_get_values (remote_desktop->sessions));
- g_list_free_full (sessions,
- (GDestroyNotify) meta_remote_desktop_session_close);
+ g_assert (g_hash_table_size (remote_desktop->sessions) == 0);
g_hash_table_destroy (remote_desktop->sessions);
G_OBJECT_CLASS (meta_remote_desktop_parent_class)->finalize (object);
@@ -276,6 +290,10 @@ meta_remote_desktop_new (MetaBackend *backend,
remote_desktop->backend = backend;
remote_desktop->session_watcher = session_watcher;
+ g_signal_connect (backend, "prepare-shutdown",
+ G_CALLBACK (on_prepare_shutdown),
+ remote_desktop);
+
return remote_desktop;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]