From: Nickolay V. Shmyrev Date: Sun, 19 Jun 2005 01:33:07 +0000 (+0000) Subject: Various small fixes, mostly memory leaks. Thanks to valgrind. X-Git-Tag: EVINCE_0_3_3~227 X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=commitdiff_plain;h=9d27e7230863e75f2530e4942fd6a0c19107d30f;p=evince.git Various small fixes, mostly memory leaks. Thanks to valgrind. * lib/ev-file-helpers.c: (ev_file_helpers_shutdown): * shell/ev-sidebar-links.c: (create_loading_model): * shell/ev-sidebar-thumbnails.c: (ev_sidebar_thumbnails_dispose): * shell/ev-view.c: (ev_view_set_document): * shell/ev-window.c: (ev_window_dispose): Various small fixes, mostly memory leaks. Thanks to valgrind. --- diff --git a/ChangeLog b/ChangeLog index 8a098c09..64d0462a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2005-06-19 Nickolay V. Shmyrev + + * lib/ev-file-helpers.c: (ev_file_helpers_shutdown): + * shell/ev-sidebar-links.c: (create_loading_model): + * shell/ev-sidebar-thumbnails.c: (ev_sidebar_thumbnails_dispose): + * shell/ev-view.c: (ev_view_set_document): + * shell/ev-window.c: (ev_window_dispose): + + Various small fixes, mostly memory leaks. Thanks to valgrind. + 2005-06-19 Martin Kretzschmar * ps/ps-document.c: remove the locale.h include again ;-). And diff --git a/lib/ev-file-helpers.c b/lib/ev-file-helpers.c index b0938535..ae8aae54 100644 --- a/lib/ev-file-helpers.c +++ b/lib/ev-file-helpers.c @@ -80,8 +80,9 @@ ev_file_helpers_init (void) void ev_file_helpers_shutdown (void) -{ - rmdir (tmp_dir); +{ + if (tmp_dir != NULL) + rmdir (tmp_dir); g_free (tmp_dir); g_free (dot_dir); diff --git a/shell/ev-sidebar-links.c b/shell/ev-sidebar-links.c index 14b4b009..6573f808 100644 --- a/shell/ev-sidebar-links.c +++ b/shell/ev-sidebar-links.c @@ -228,7 +228,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_OBJECT, + G_TYPE_POINTER, G_TYPE_BOOLEAN); gtk_list_store_append (GTK_LIST_STORE (retval), &iter); diff --git a/shell/ev-sidebar-thumbnails.c b/shell/ev-sidebar-thumbnails.c index 93f41504..c2c07c84 100644 --- a/shell/ev-sidebar-thumbnails.c +++ b/shell/ev-sidebar-thumbnails.c @@ -101,9 +101,16 @@ ev_sidebar_thumbnails_dispose (GObject *object) EvSidebarThumbnails *sidebar_thumbnails = EV_SIDEBAR_THUMBNAILS (object); ev_sidebar_thumbnails_clear_model (sidebar_thumbnails); - g_object_unref (sidebar_thumbnails->priv->loading_icon); - g_object_unref (sidebar_thumbnails->priv->list_store); - + if (sidebar_thumbnails->priv->loading_icon) { + g_object_unref (sidebar_thumbnails->priv->loading_icon); + sidebar_thumbnails->priv->loading_icon = NULL; + } + + if (sidebar_thumbnails->priv->list_store) { + g_object_unref (sidebar_thumbnails->priv->list_store); + sidebar_thumbnails->priv->list_store = NULL; + } + G_OBJECT_CLASS (ev_sidebar_thumbnails_parent_class)->dispose (object); } diff --git a/shell/ev-view.c b/shell/ev-view.c index c366b04c..5cc6f57d 100644 --- a/shell/ev-view.c +++ b/shell/ev-view.c @@ -1931,6 +1931,8 @@ ev_view_set_document (EvView *view, g_return_if_fail (EV_IS_VIEW (view)); if (document != view->document) { + clear_caches (view); + if (view->document) { g_signal_handlers_disconnect_by_func (view->document, find_changed_cb, @@ -1940,8 +1942,6 @@ ev_view_set_document (EvView *view, } - clear_caches (view); - view->document = document; view->find_page = 0; view->find_result = 0; diff --git a/shell/ev-window.c b/shell/ev-window.c index 10bdb9cd..509ac252 100644 --- a/shell/ev-window.c +++ b/shell/ev-window.c @@ -2409,6 +2409,11 @@ ev_window_dispose (GObject *object) priv->toolbar_file = NULL; } + if (priv->recent_model) { + g_object_unref (priv->recent_model); + priv->recent_model = NULL; + } + if (priv->ui_manager) { g_object_unref (priv->ui_manager); priv->ui_manager = NULL;