From: Jim Evins Date: Mon, 27 Oct 2003 04:15:24 +0000 (+0000) Subject: Fix for Bug #822848: in gl_window_destroy() unreference window->uic and recent_view. X-Git-Tag: glabels-2_3_0~562 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=5b8870cdd41d8dbede3ef438b87b030f0bf89591;p=glabels Fix for Bug #822848: in gl_window_destroy() unreference window->uic and recent_view. 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 --- diff --git a/glabels2/src/ui.c b/glabels2/src/ui.c index 4efd9219..0900d653 100644 --- a/glabels2/src/ui.c +++ b/glabels2/src/ui.c @@ -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"); } diff --git a/glabels2/src/window.c b/glabels2/src/window.c index 86e741c8..347b4d08 100644 --- a/glabels2/src/window.c +++ b/glabels2/src/window.c @@ -22,6 +22,7 @@ #include +#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); }