]> www.fi.muni.cz Git - evince.git/commitdiff
Fixed lot's of memory leaks, for example, memory leak on reload, described
authorNickolay V. Shmyrev <nshmyrev@src.gnome.org>
Sat, 18 Jun 2005 19:22:00 +0000 (19:22 +0000)
committerNickolay V. Shmyrev <nshmyrev@src.gnome.org>
Sat, 18 Jun 2005 19:22:00 +0000 (19:22 +0000)
       * 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.

ChangeLog
shell/ev-page-action.c
shell/ev-sidebar-links.c
shell/ev-sidebar.c
shell/ev-window.c

index b493b948286acfd86627f954c6f02fc037ebb9a6..57cb4cf251aeca2a3f5218b57304346b54c31529 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2005-06-18  Nickolay V. Shmyrev  <nshmyrev@yandex.ru>
+
+       * 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  <mpg@redhat.com>
 
        * pdf/ev-poppler.cc:
index 5b45b31d898ed404ea0292e818e7934f9bdc3a32..ee4802ab17cba72197c5a7642cb258e1daafaa14 100644 (file)
@@ -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);
        }
 }
 
index 84b49dd292b47175aa5c0ac03df28e149082aba5..14b4b00982935986c5527bd5067206563a660af3 100644 (file)
@@ -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) {
index f687d10f4dc379ac38e061021b4370fbb37a654a..12bd17183431727c7ceee51b81087b37f8bfaadc 100644 (file)
@@ -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) {
index b9eb24e430c256aaf86ded5c93a24e458747af98..10bdb9cd6e9cfcfe6bf2badab566acaf730ba8f7 100644 (file)
@@ -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);
        }
 }