]> git.sur5r.net Git - glabels/commitdiff
Fix for Bug #822848: in gl_window_destroy() unreference window->uic and recent_view.
authorJim Evins <evins@snaught.com>
Mon, 27 Oct 2003 04:15:24 +0000 (04:15 +0000)
committerJim Evins <evins@snaught.com>
Mon, 27 Oct 2003 04:15:24 +0000 (04:15 +0000)
Hack:  squirrel away recent_view as data in window->uic, and extract this in gl_window_destroy().  A better approach might be to wrap up the ui_component in its own object, then simply unreference it.

git-svn-id: https://glabels.svn.sourceforge.net/svnroot/glabels/trunk@328 f5e0f49d-192f-0410-a22d-a8d8700d0965

glabels2/src/ui.c
glabels2/src/window.c

index 4efd9219463997255e92ded0f313b69cfd376a42..0900d653a918f1639f271d9d72e4a8ec92dd1d40 100644 (file)
@@ -301,6 +301,8 @@ gl_ui_init (BonoboUIComponent *ui_component,
        gl_ui_util_set_verb_list_sensitive (ui_component, doc_verbs, FALSE);
 
        /* Status bar */
+       gl_debug (DEBUG_UI, "START Setup status bar.");
+
         bonobo_ui_component_set_prop (ui_component,
                                      "/status", "hidden", "0", NULL);
 
@@ -318,17 +320,22 @@ gl_ui_init (BonoboUIComponent *ui_component,
         bonobo_ui_component_set_prop (ui_component,
                                      "/status/Zoom", "hidden", "0", NULL);
 
+       gl_debug (DEBUG_UI, "END Setup status bar.");
+
 
-       /* add a GeditRecentView object */
+       /* add an eggRecentView object */
         recent_model = gl_recent_get_model ();
         recent_view  =
                EGG_RECENT_VIEW (egg_recent_view_bonobo_new (ui_component,
-                                                              "/menu/File/Recents"));
+                                                            "/menu/File/Recents"));
        egg_recent_view_set_model (recent_view, recent_model);
 
        g_signal_connect (G_OBJECT (recent_view), "activate",
                          G_CALLBACK (gl_file_open_recent), win);
 
+       /* Hack:  squirrel away a copy to be unreferenced in gl_window_destroy() */
+       g_object_set_data (G_OBJECT (ui_component), "recent-view", recent_view);
+
        gl_debug (DEBUG_UI, "END");
 }
 
index 86e741c81f894f65a2900551f03f483e3151cd47..347b4d084187b197da2d8cdb40e96f43ca1e44cc 100644 (file)
@@ -22,6 +22,7 @@
 
 #include <config.h>
 
+#include "recent-files/egg-recent-view.h"
 #include "ui.h"
 #include "window.h"
 #include "util.h"
@@ -214,6 +215,19 @@ gl_window_destroy (GtkObject *gtk_object)
        window = GL_WINDOW (gtk_object);
        window_list = g_list_remove (window_list, window);
 
+        if (window->uic) {
+               EggRecentView *recent_view;
+
+               /* Hack:  pull out recent view to unreference. */
+               recent_view = g_object_get_data (G_OBJECT(window->uic), "recent-view");
+               if (recent_view) {
+                       g_object_unref (recent_view);
+               }
+
+               bonobo_object_unref(window->uic);
+               window->uic = NULL;
+        }
+
        if (GTK_OBJECT_CLASS (parent_class)->destroy) {
                GTK_OBJECT_CLASS (parent_class)->destroy (gtk_object);
        }