[eog] EogWindow: Hold a reference on the used ThumbView



commit 3145fce6d7544dfb6e159924fb52e2ca13b7a42c
Author: Felix Riemann <friemann gnome org>
Date:   Sun Jan 13 16:58:49 2013 +0100

    EogWindow: Hold a reference on the used ThumbView
    
    The window uses it during runtime so it should keep a reference
    to it. Due to the necessary unref this avoids critical warnings
    because of EogThumbView's own disposal routine causing an
    unwanted signal emission.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=691517

 src/eog-window.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/src/eog-window.c b/src/eog-window.c
index 91fa9da..4b66a08 100644
--- a/src/eog-window.c
+++ b/src/eog-window.c
@@ -4664,7 +4664,7 @@ eog_window_construct_ui (EogWindow *window)
 
 	gtk_box_pack_start (GTK_BOX (priv->layout), hpaned, TRUE, TRUE, 0);
 
-	priv->thumbview = eog_thumb_view_new ();
+	priv->thumbview = g_object_ref (eog_thumb_view_new ());
 
 	/* giving shape to the view */
 	gtk_icon_view_set_margin (GTK_ICON_VIEW (priv->thumbview), 4);
@@ -4906,6 +4906,16 @@ eog_window_dispose (GObject *object)
 		priv->page_setup = NULL;
 	}
 
+	if (priv->thumbview)
+	{
+		/* Disconnect so we don't get any unwanted callbacks
+		 * when the thumb view is disposed. */
+		g_signal_handlers_disconnect_by_func (priv->thumbview,
+		                 G_CALLBACK (handle_image_selection_changed_cb),
+		                 window);
+		g_clear_object (&priv->thumbview);
+	}
+
 	peas_engine_garbage_collect (PEAS_ENGINE (EOG_APP->priv->plugin_engine));
 
 	G_OBJECT_CLASS (eog_window_parent_class)->dispose (object);



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