[gnome-remote-desktop] context: Clear proxies before setting new proxies



commit 7e34046c21ed678ec83ea7bee052526e5f15787e
Author: Pascal Nowack <Pascal Nowack gmx de>
Date:   Mon Nov 22 17:55:26 2021 +0100

    context: Clear proxies before setting new proxies
    
    Since the context has the last reference on the proxies, it has to take
    care of their destruction.
    So, destroy the remote-desktop- and screen-cast-proxy before setting new
    values.
    Also make sure that both proxies are cleared on destruction of the
    context.

 src/grd-context.c | 4 ++++
 1 file changed, 4 insertions(+)
---
diff --git a/src/grd-context.c b/src/grd-context.c
index 6212caf..53bb52b 100644
--- a/src/grd-context.c
+++ b/src/grd-context.c
@@ -65,6 +65,7 @@ void
 grd_context_set_remote_desktop_proxy (GrdContext           *context,
                                       GrdDBusRemoteDesktop *proxy)
 {
+  g_clear_object (&context->remote_desktop_proxy);
   context->remote_desktop_proxy = proxy;
 }
 
@@ -72,6 +73,7 @@ void
 grd_context_set_screen_cast_proxy (GrdContext        *context,
                                    GrdDBusScreenCast *proxy)
 {
+  g_clear_object (&context->screen_cast_proxy);
   context->screen_cast_proxy = proxy;
 }
 
@@ -135,6 +137,8 @@ grd_context_finalize (GObject *object)
 {
   GrdContext *context = GRD_CONTEXT (object);
 
+  g_clear_object (&context->remote_desktop_proxy);
+  g_clear_object (&context->screen_cast_proxy);
   g_clear_object (&context->settings);
 
   G_OBJECT_CLASS (grd_context_parent_class)->finalize (object);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]