From: Nickolay V. Shmyrev Date: Sun, 19 Jun 2005 13:10:20 +0000 (+0000) Subject: Fix memory leak X-Git-Tag: EVINCE_0_3_3~221 X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=commitdiff_plain;h=bb5ea194600d5ae09b18a147420f4fc42c0808df;p=evince.git Fix memory leak * cut-n-paste/recent-files/egg-recent-view-gtk.c: (egg_recent_view_gtk_finalize): Fix memory leak * cut-n-paste/toolbar-editor/Makefile.am: Fix location of cursor icon. * pdf/ev-poppler.cc: * shell/ev-page-action.c: (build_new_tree_cb), (match_selected_cb), (display_completion_text), (match_completion): * shell/ev-sidebar-links.c: (ev_sidebar_links_dispose), (selection_changed_callback), (create_loading_model), (print_section_cb), (links_page_num_func), (update_page_callback_foreach): * shell/ev-window.c: (ev_window_dispose): Small memory fixes. Links model now store objects instead of pointers to improve memory management. --- diff --git a/ChangeLog b/ChangeLog index 27e37a66..9e1b7941 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,26 @@ +2005-06-19 Nickolay V. Shmyrev + + * cut-n-paste/recent-files/egg-recent-view-gtk.c: + (egg_recent_view_gtk_finalize): + + Fix memory leak + + * cut-n-paste/toolbar-editor/Makefile.am: + + Fix location of cursor icon. + + * pdf/ev-poppler.cc: + * shell/ev-page-action.c: (build_new_tree_cb), (match_selected_cb), + (display_completion_text), (match_completion): + * shell/ev-sidebar-links.c: (ev_sidebar_links_dispose), + (selection_changed_callback), (create_loading_model), + (print_section_cb), (links_page_num_func), + (update_page_callback_foreach): + * shell/ev-window.c: (ev_window_dispose): + + Small memory fixes. Links model now store objects instead + of pointers to improve memory management. + 2005-06-19 Nickolay V. Shmyrev * shell/ev-window.c: (zoom_control_changed_cb): diff --git a/cut-n-paste/recent-files/egg-recent-view-gtk.c b/cut-n-paste/recent-files/egg-recent-view-gtk.c index f9e0bd2f..36acf63e 100644 --- a/cut-n-paste/recent-files/egg-recent-view-gtk.c +++ b/cut-n-paste/recent-files/egg-recent-view-gtk.c @@ -523,6 +523,8 @@ egg_recent_view_gtk_finalize (GObject *object) g_object_unref (view->client); g_object_unref (view->tooltips); + + egg_recent_view_gtk_clear (view); } static void diff --git a/cut-n-paste/toolbar-editor/Makefile.am b/cut-n-paste/toolbar-editor/Makefile.am index 3bd7b284..1c9a09d9 100644 --- a/cut-n-paste/toolbar-editor/Makefile.am +++ b/cut-n-paste/toolbar-editor/Makefile.am @@ -22,11 +22,11 @@ libtoolbareditor_la_SOURCES = \ libtoolbareditor_la_CPPFLAGS = \ -I$(top_builddir)/lib/egg \ - -DCURSOR_DIR=\"$(pkgdatadir)/art\" \ $(AM_CPPFLAGS) libtoolbareditor_la_CFLAGS = \ $(TOOLBAR_EDITOR_CFLAGS) \ + -DCURSOR_DIR=\"$(pkgdatadir)\" \ $(AM_CFLAGS) BUILT_SOURCES = \ diff --git a/pdf/ev-poppler.cc b/pdf/ev-poppler.cc index 8479ad43..90bae3ae 100644 --- a/pdf/ev-poppler.cc +++ b/pdf/ev-poppler.cc @@ -755,7 +755,7 @@ pdf_document_links_get_links_model (EvDocumentLinks *document_links) if (iter != NULL) { model = (GtkTreeModel *) gtk_tree_store_new (EV_DOCUMENT_LINKS_COLUMN_NUM_COLUMNS, G_TYPE_STRING, - G_TYPE_POINTER, + G_TYPE_OBJECT, G_TYPE_BOOLEAN); build_tree (pdf_document, model, NULL, iter); poppler_index_iter_free (iter); diff --git a/shell/ev-page-action.c b/shell/ev-page-action.c index ee4802ab..7975c8a4 100644 --- a/shell/ev-page-action.c +++ b/shell/ev-page-action.c @@ -306,6 +306,9 @@ build_new_tree_cb (GtkTreeModel *model, -1); } + if (link) + g_object_unref (link); + return FALSE; } @@ -346,6 +349,9 @@ match_selected_cb (GtkEntryCompletion *completion, g_signal_emit (proxy, widget_signals[WIDGET_ACTIVATE_LINK], 0, link); + if (link) + g_object_unref (link); + gtk_tree_iter_free (iter); return TRUE; @@ -370,6 +376,9 @@ display_completion_text (GtkCellLayout *cell_layout, -1); g_object_set (renderer, "text", ev_link_get_title (link), NULL); + + if (link) + g_object_unref (link); gtk_tree_iter_free (iter); } @@ -395,6 +404,7 @@ match_completion (GtkEntryCompletion *completion, if (link) { text = ev_link_get_title (link); + g_object_unref (link); } gtk_tree_iter_free (iter); diff --git a/shell/ev-sidebar-links.c b/shell/ev-sidebar-links.c index 6573f808..55f2ddb3 100644 --- a/shell/ev-sidebar-links.c +++ b/shell/ev-sidebar-links.c @@ -151,6 +151,11 @@ ev_sidebar_links_dispose (GObject *object) sidebar->priv->job = NULL; } + if (sidebar->priv->model) { + g_object_unref (sidebar->priv->model); + sidebar->priv->model = NULL; + } + if (sidebar->priv->document) { g_object_unref (sidebar->priv->document); sidebar->priv->document = NULL; @@ -215,6 +220,8 @@ selection_changed_callback (GtkTreeSelection *selection, ev_page_cache_set_link (ev_sidebar_links->priv->page_cache, link); g_signal_handler_unblock (ev_sidebar_links->priv->page_cache, ev_sidebar_links->priv->page_changed_id); + + g_object_unref (link); } } @@ -228,7 +235,7 @@ create_loading_model (void) /* Creates a fake model to indicate that we're loading */ retval = (GtkTreeModel *)gtk_list_store_new (EV_DOCUMENT_LINKS_COLUMN_NUM_COLUMNS, G_TYPE_STRING, - G_TYPE_POINTER, + G_TYPE_OBJECT, G_TYPE_BOOLEAN); gtk_list_store_append (GTK_LIST_STORE (retval), &iter); @@ -263,11 +270,17 @@ print_section_cb (GtkWidget *menuitem, EvSidebarLinks *sidebar) -1); first_page = ev_link_get_page (link) + 1; + if (link) + g_object_unref (link); + if (gtk_tree_model_iter_next (model, &iter)) { gtk_tree_model_get (model, &iter, EV_DOCUMENT_LINKS_COLUMN_LINK, &link, -1); last_page = ev_link_get_page (link); + + if (link) + g_object_unref (link); } else { last_page = -1; } @@ -440,6 +453,9 @@ links_page_num_func (GtkTreeViewColumn *tree_column, "visible", FALSE, NULL); } + + if (link) + g_object_unref (link); } /* Public Functions */ @@ -477,10 +493,14 @@ update_page_callback_foreach (GtkTreeModel *model, selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (sidebar_links->priv->tree_view)); gtk_tree_selection_select_path (selection, path); - + + g_object_unref (link); return TRUE; } } + + if (link) + g_object_unref (link); return FALSE; } diff --git a/shell/ev-window.c b/shell/ev-window.c index 693e0698..81e4f316 100644 --- a/shell/ev-window.c +++ b/shell/ev-window.c @@ -2417,6 +2417,12 @@ ev_window_dispose (GObject *object) priv->recent_model = NULL; } + if (priv->recent_view) { + g_object_unref (priv->recent_view); + priv->recent_view = NULL; + } + + if (priv->ui_manager) { g_object_unref (priv->ui_manager); priv->ui_manager = NULL;