[virt-tools-list] [virt-viewer v2 4/4] window: Don't take a reference on 'toolbar'

Fabiano Fidêncio fidencio at redhat.com
Tue Jun 28 15:23:02 UTC 2016


From: Christophe Fergeau <cfergeau at redhat.com>

VirtViewerTimedRevealer now derives from GtkEventBox/GtkContainer, so
it follows GTK+ conventions and takes ownership of the floating ref on
'toolbar'. Since VirtViewerWindow and VirtViewerTimedRevealer will have
the same lifespan, we don't need to own a reference on toolbar in
VirtViewerWindow.
---
 src/virt-viewer-window.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/virt-viewer-window.c b/src/virt-viewer-window.c
index bf48516..503e230 100644
--- a/src/virt-viewer-window.c
+++ b/src/virt-viewer-window.c
@@ -200,7 +200,7 @@ virt_viewer_window_dispose (GObject *object)
     priv->subtitle = NULL;
 
     g_value_unset(&priv->accel_setting);
-    g_clear_object(&priv->toolbar);
+    priv->toolbar = NULL;
 
     G_OBJECT_CLASS (virt_viewer_window_parent_class)->dispose (object);
 }
@@ -1070,7 +1070,7 @@ virt_viewer_window_toolbar_setup(VirtViewerWindow *self)
     GtkWidget *overlay;
     VirtViewerWindowPrivate *priv = self->priv;
 
-    priv->toolbar = g_object_ref(gtk_toolbar_new());
+    priv->toolbar = gtk_toolbar_new();
     gtk_toolbar_set_show_arrow(GTK_TOOLBAR(priv->toolbar), FALSE);
     gtk_widget_set_no_show_all(priv->toolbar, TRUE);
     gtk_toolbar_set_style(GTK_TOOLBAR(priv->toolbar), GTK_TOOLBAR_BOTH_HORIZ);
-- 
2.7.4




More information about the virt-tools-list mailing list