From: Nickolay V. Shmyrev Date: Sat, 18 Jun 2005 19:22:00 +0000 (+0000) Subject: Fixed lot's of memory leaks, for example, memory leak on reload, described X-Git-Tag: EVINCE_0_3_3~231 X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=commitdiff_plain;h=f302b9a420aaf02e5805b3225ce4fef5a63e9b67;p=evince.git Fixed lot's of memory leaks, for example, memory leak on reload, described * shell/ev-page-action.c: (match_selected_cb), (display_completion_text), (match_completion), (update_model): * shell/ev-sidebar-links.c: (ev_sidebar_links_dispose), (expand_open_links): * shell/ev-sidebar.c: (ev_sidebar_destroy), (ev_sidebar_menu_item_activate_cb), (ev_sidebar_add_page), (ev_sidebar_set_document): * shell/ev-window.c: (ev_window_xfer_job_cb), (sidebar_widget_model_set), (sidebar_page_main_widget_update_cb): Fixed lot's of memory leaks, for example, memory leak on reload, described in bug 307793. --- diff --git a/ChangeLog b/ChangeLog index b493b948..57cb4cf2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2005-06-18 Nickolay V. Shmyrev + + * shell/ev-page-action.c: (match_selected_cb), + (display_completion_text), (match_completion), (update_model): + * shell/ev-sidebar-links.c: (ev_sidebar_links_dispose), + (expand_open_links): + * shell/ev-sidebar.c: (ev_sidebar_destroy), + (ev_sidebar_menu_item_activate_cb), (ev_sidebar_add_page), + (ev_sidebar_set_document): + * shell/ev-window.c: (ev_window_xfer_job_cb), + (sidebar_widget_model_set), (sidebar_page_main_widget_update_cb): + + Fixed lot's of memory leaks, for example, memory leak on reload, + described in bug 307793. + 2005-06-18 Marco Pesenti Gritti * pdf/ev-poppler.cc: diff --git a/shell/ev-page-action.c b/shell/ev-page-action.c index 5b45b31d..ee4802ab 100644 --- a/shell/ev-page-action.c +++ b/shell/ev-page-action.c @@ -345,6 +345,8 @@ match_selected_cb (GtkEntryCompletion *completion, -1); g_signal_emit (proxy, widget_signals[WIDGET_ACTIVATE_LINK], 0, link); + + gtk_tree_iter_free (iter); return TRUE; } @@ -368,6 +370,8 @@ display_completion_text (GtkCellLayout *cell_layout, -1); g_object_set (renderer, "text", ev_link_get_title (link), NULL); + + gtk_tree_iter_free (iter); } static gboolean @@ -389,8 +393,11 @@ match_completion (GtkEntryCompletion *completion, -1); - if (link) + if (link) { text = ev_link_get_title (link); + } + + gtk_tree_iter_free (iter); if (text && key ) { gchar *normalized_text; @@ -461,6 +468,8 @@ update_model (EvPageAction *page, GParamSpec *pspec, EvPageActionWidget *proxy) (GtkCellLayoutDataFunc) display_completion_text, proxy, NULL); gtk_entry_set_completion (GTK_ENTRY (proxy->entry), completion); + + g_object_unref (model); } } diff --git a/shell/ev-sidebar-links.c b/shell/ev-sidebar-links.c index 84b49dd2..14b4b009 100644 --- a/shell/ev-sidebar-links.c +++ b/shell/ev-sidebar-links.c @@ -143,12 +143,6 @@ ev_sidebar_links_dispose (GObject *object) { EvSidebarLinks *sidebar = EV_SIDEBAR_LINKS (object); - if (sidebar->priv->document) { - g_object_unref (sidebar->priv->document); - sidebar->priv->document = NULL; - sidebar->priv->page_cache = NULL; - } - if (sidebar->priv->job) { g_signal_handlers_disconnect_by_func (sidebar->priv->job, job_finished_callback, sidebar); @@ -157,6 +151,13 @@ ev_sidebar_links_dispose (GObject *object) sidebar->priv->job = NULL; } + if (sidebar->priv->document) { + g_object_unref (sidebar->priv->document); + sidebar->priv->document = NULL; + sidebar->priv->page_cache = NULL; + } + + G_OBJECT_CLASS (ev_sidebar_links_parent_class)->dispose (object); } @@ -529,13 +530,11 @@ static void expand_open_links (GtkTreeView *tree_view, GtkTreeModel *model, GtkTreeIter *parent) { GtkTreeIter iter; - EvLink *link; gboolean expand; if (gtk_tree_model_iter_children (model, &iter, parent)) { do { gtk_tree_model_get (model, &iter, - EV_DOCUMENT_LINKS_COLUMN_LINK, &link, EV_DOCUMENT_LINKS_COLUMN_EXPAND, &expand, -1); if (expand) { diff --git a/shell/ev-sidebar.c b/shell/ev-sidebar.c index f687d10f..12bd1718 100644 --- a/shell/ev-sidebar.c +++ b/shell/ev-sidebar.c @@ -65,6 +65,12 @@ ev_sidebar_destroy (GtkObject *object) gtk_menu_detach (GTK_MENU (ev_sidebar->priv->menu)); ev_sidebar->priv->menu = NULL; } + + if (ev_sidebar->priv->page_model) { + g_object_unref (ev_sidebar->priv->page_model); + ev_sidebar->priv->page_model = NULL; + } + (* GTK_OBJECT_CLASS (ev_sidebar_parent_class)->destroy) (object); } @@ -217,6 +223,8 @@ ev_sidebar_menu_item_activate_cb (GtkWidget *widget, } else { valid = gtk_tree_model_iter_next (ev_sidebar->priv->page_model, &iter); } + g_object_unref (item); + g_free (title); } } @@ -365,6 +373,7 @@ ev_sidebar_add_page (EvSidebar *ev_sidebar, gtk_label_set_text (GTK_LABEL (ev_sidebar->priv->label), label_title); gtk_notebook_set_current_page (GTK_NOTEBOOK (ev_sidebar->priv->notebook), index); + g_free (label_title); } void @@ -401,6 +410,8 @@ ev_sidebar_set_document (EvSidebar *sidebar, } else { gtk_widget_set_sensitive (menu_widget, FALSE); } + g_object_unref (widget); + g_object_unref (menu_widget); } if (!has_pages) { diff --git a/shell/ev-window.c b/shell/ev-window.c index b9eb24e4..10bdb9cd 100644 --- a/shell/ev-window.c +++ b/shell/ev-window.c @@ -889,6 +889,7 @@ ev_window_xfer_job_cb (EvJobXfer *job, G_CALLBACK (ev_window_load_job_cb), ev_window); ev_job_queue_add_job (ev_window->priv->load_job, EV_JOB_PRIORITY_HIGH); + g_object_unref (document); } } @@ -2857,6 +2858,7 @@ sidebar_widget_model_set (EvSidebarLinks *ev_sidebar_links, action = gtk_action_group_get_action (ev_window->priv->action_group, PAGE_SELECTOR_ACTION); ev_page_action_set_model (EV_PAGE_ACTION (action), model); + g_object_unref (model); } @@ -2900,13 +2902,14 @@ sidebar_page_main_widget_update_cb (GObject *ev_sidebar_page, g_object_get (ev_sidebar_page, "main_widget", &widget, NULL); - if (widget != NULL) { - g_signal_connect_object (widget, "focus_in_event", - G_CALLBACK (view_actions_focus_in_cb), + if (widget != NULL) { + g_signal_connect_object (widget, "focus_in_event", + G_CALLBACK (view_actions_focus_in_cb), ev_window, 0); - g_signal_connect_object (widget, "focus_out_event", - G_CALLBACK (view_actions_focus_out_cb), + g_signal_connect_object (widget, "focus_out_event", + G_CALLBACK (view_actions_focus_out_cb), ev_window, 0); + g_object_unref (widget); } }