[gnome-photos] preview-nav-buttons: Break a reference cycle



commit 45a1d4fb41e00faa709882c84e93a600bc0de9e4
Author: Debarshi Ray <debarshir gnome org>
Date:   Mon Dec 14 20:13:06 2015 +0100

    preview-nav-buttons: Break a reference cycle
    
    PreviewView is supposed to own PreviewNavButtons. Therefore, the latter
    shouldn't hold a reference on the former.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=746940

 src/photos-preview-nav-buttons.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/src/photos-preview-nav-buttons.c b/src/photos-preview-nav-buttons.c
index 8ada3d6..282945b 100644
--- a/src/photos-preview-nav-buttons.c
+++ b/src/photos-preview-nav-buttons.c
@@ -370,8 +370,6 @@ photos_preview_nav_buttons_dispose (GObject *object)
 
   g_clear_object (&priv->tap_gesture);
   g_clear_object (&priv->model);
-  g_clear_object (&priv->overlay);
-  g_clear_object (&priv->preview_view);
   g_clear_object (&priv->item_mngr);
   g_clear_object (&priv->mode_cntrlr);
 
@@ -469,6 +467,10 @@ photos_preview_nav_buttons_constructed (GObject *object)
                             "stopped",
                             G_CALLBACK (photos_preview_nav_buttons_multi_press_stopped),
                             self);
+
+  /* We will not need them any more */
+  priv->overlay = NULL;
+  priv->preview_view = NULL;
 }
 
 
@@ -481,11 +483,11 @@ photos_preview_nav_buttons_set_property (GObject *object, guint prop_id, const G
   switch (prop_id)
     {
     case PROP_OVERLAY:
-      priv->overlay = GTK_WIDGET (g_value_dup_object (value));
+      priv->overlay = GTK_WIDGET (g_value_get_object (value)); /* overlay is owned by preview_view */
       break;
 
     case PROP_PREVIEW_VIEW:
-      priv->preview_view = GTK_WIDGET (g_value_dup_object (value));
+      priv->preview_view = GTK_WIDGET (g_value_get_object (value)); /* self is owned by preview_view */
       break;
 
     default:


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