diff --git a/src/backends/meta-screen-cast-session.c b/src/backends/meta-screen-cast-session.c index 3925738d4..60fffdea5 100644 --- a/src/backends/meta-screen-cast-session.c +++ b/src/backends/meta-screen-cast-session.c @@ -194,6 +194,12 @@ meta_screen_cast_session_get_peer_name (MetaScreenCastSession *session) return session->peer_name; } +MetaScreenCastSessionType +meta_screen_cast_session_get_session_type (MetaScreenCastSession *session) +{ + return session->session_type; +} + static gboolean check_permission (MetaScreenCastSession *session, GDBusMethodInvocation *invocation) diff --git a/src/backends/meta-screen-cast-session.h b/src/backends/meta-screen-cast-session.h index 3bab3486b..46bde5eb9 100644 --- a/src/backends/meta-screen-cast-session.h +++ b/src/backends/meta-screen-cast-session.h @@ -49,6 +49,8 @@ char * meta_screen_cast_session_get_object_path (MetaScreenCastSession *session) char * meta_screen_cast_session_get_peer_name (MetaScreenCastSession *session); +MetaScreenCastSessionType meta_screen_cast_session_get_session_type (MetaScreenCastSession *session); + MetaScreenCastSession * meta_screen_cast_session_new (MetaScreenCast *screen_cast, MetaScreenCastSessionType session_type, const char *peer_name, diff --git a/src/backends/meta-screen-cast.c b/src/backends/meta-screen-cast.c index 13809d853..6162b8d27 100644 --- a/src/backends/meta-screen-cast.c +++ b/src/backends/meta-screen-cast.c @@ -323,14 +323,23 @@ meta_screen_cast_finalize (GObject *object) if (screen_cast->dbus_name_id) g_bus_unown_name (screen_cast->dbus_name_id); + g_assert (!screen_cast->sessions); + + G_OBJECT_CLASS (meta_screen_cast_parent_class)->finalize (object); +} + +static void +on_prepare_shutdown (MetaBackend *backend, + MetaScreenCast *screen_cast) +{ while (screen_cast->sessions) { MetaScreenCastSession *session = screen_cast->sessions->data; - meta_screen_cast_session_close (session); + if (meta_screen_cast_session_get_session_type (session) != + META_SCREEN_CAST_SESSION_TYPE_REMOTE_DESKTOP) + meta_screen_cast_session_close (session); } - - G_OBJECT_CLASS (meta_screen_cast_parent_class)->finalize (object); } MetaScreenCast * @@ -343,6 +352,10 @@ meta_screen_cast_new (MetaBackend *backend, screen_cast->backend = backend; screen_cast->session_watcher = session_watcher; + g_signal_connect (backend, "prepare-shutdown", + G_CALLBACK (on_prepare_shutdown), + screen_cast); + return screen_cast; }