]> www.fi.muni.cz Git - evince.git/commitdiff
Fix memory leak
authorNickolay V. Shmyrev <nshmyrev@src.gnome.org>
Sun, 19 Jun 2005 13:10:20 +0000 (13:10 +0000)
committerNickolay V. Shmyrev <nshmyrev@src.gnome.org>
Sun, 19 Jun 2005 13:10:20 +0000 (13:10 +0000)
* 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.

ChangeLog
cut-n-paste/recent-files/egg-recent-view-gtk.c
cut-n-paste/toolbar-editor/Makefile.am
pdf/ev-poppler.cc
shell/ev-page-action.c
shell/ev-sidebar-links.c
shell/ev-window.c

index 27e37a665b9bacb76ded049a284d5204f91e4959..9e1b7941b097da5ee1cd083e6d6eef8f8f4f1504 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,26 @@
+2005-06-19  Nickolay V. Shmyrev  <nshmyrev@yandex.ru>
+
+       * 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  <nshmyrev@yandex.ru>
 
        * shell/ev-window.c: (zoom_control_changed_cb):
index f9e0bd2f6b2a1655891ab365185a99699dbf59be..36acf63e34bb6458c90fc6d31424dd8fa2a30b63 100644 (file)
@@ -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
index 3bd7b2846b0493ca524fb2e91bc13690ff7c859b..1c9a09d9c4c167352dabf9caa1f668fd93191a24 100644 (file)
@@ -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 = \
index 8479ad4336fa4fd99fff23666e499b51f797f50e..90bae3ae3251643e8957636a7b28bc12e21c3e66 100644 (file)
@@ -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);
index ee4802ab17cba72197c5a7642cb258e1daafaa14..7975c8a41577b1e83e106d4cf350bf9445c37507 100644 (file)
@@ -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);
index 6573f808ac06645ef443334bd372f6297ef3e6b4..55f2ddb341d787c29835781fea65e270e41708e4 100644 (file)
@@ -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;
 }
index 693e069806c5850961b7a0ebe8e3460f44725437..81e4f316cf2f3c63b745434e69a0480dd7d09809 100644 (file)
@@ -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;