[PATCH 05/11] virt-viewer-window: Use a borrowed reference to app

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

 



Before this patch there was a cyclic reference between VirtViewerApp and
VirtViewerWindow, since all VirtViewerWindows are created / destroyed by
VirtViewerApp it is safe to assume that lifetime of VirtViewerApp >=
VirtViewerWindow, so VirtViewerWindow can take a borrowed reference
breaking the circle, and allowing proper cleanup on exit.

Signed-off-by: Hans de Goede <hdegoede@xxxxxxxxxx>
---
 src/virt-viewer-window.c |    7 +------
 1 files changed, 1 insertions(+), 6 deletions(-)

diff --git a/src/virt-viewer-window.c b/src/virt-viewer-window.c
index 708678a..77283f5 100644
--- a/src/virt-viewer-window.c
+++ b/src/virt-viewer-window.c
@@ -164,7 +164,7 @@ virt_viewer_window_set_property (GObject *object, guint property_id,
 
     case PROP_APP:
         g_return_if_fail(priv->app == NULL);
-        priv->app = g_value_dup_object(value);
+        priv->app = g_value_get_object(value);
         break;
 
     default:
@@ -183,11 +183,6 @@ virt_viewer_window_dispose (GObject *object)
         priv->display = NULL;
     }
 
-    if (priv->app) {
-        g_object_unref(priv->app);
-        priv->app = NULL;
-    }
-
     g_free(priv->subtitle);
     priv->subtitle = NULL;
 }
-- 
1.7.7.6


[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux