[evince] Fix memory leak in ev_sidebar_thumbnails_document_changed_cb()



commit 702c7c6473570152992de9ff019ee6bff85da96b
Author: Eric R. Schulz <eric ers35 com>
Date:   Sat Sep 3 11:54:31 2016 -0400

    Fix memory leak in ev_sidebar_thumbnails_document_changed_cb()
    
    Clear the loading icon hash table if it already exists.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=770070

 shell/ev-sidebar-thumbnails.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/shell/ev-sidebar-thumbnails.c b/shell/ev-sidebar-thumbnails.c
index d4c6de7..253eabf 100644
--- a/shell/ev-sidebar-thumbnails.c
+++ b/shell/ev-sidebar-thumbnails.c
@@ -982,10 +982,14 @@ ev_sidebar_thumbnails_document_changed_cb (EvDocumentModel     *model,
        priv->n_pages = ev_document_get_n_pages (document);
        priv->rotation = ev_document_model_get_rotation (model);
        priv->inverted_colors = ev_document_model_get_inverted_colors (model);
-       priv->loading_icons = g_hash_table_new_full (g_str_hash,
-                                                    g_str_equal,
-                                                    (GDestroyNotify)g_free,
-                                                    (GDestroyNotify)cairo_surface_destroy);
+       if (priv->loading_icons) {
+                g_hash_table_remove_all (priv->loading_icons);
+       } else {
+                priv->loading_icons = g_hash_table_new_full (g_str_hash,
+                                                             g_str_equal,
+                                                             (GDestroyNotify)g_free,
+                                                             (GDestroyNotify)cairo_surface_destroy);
+       }
 
        ev_sidebar_thumbnails_clear_model (sidebar_thumbnails);
        ev_sidebar_thumbnails_fill_model (sidebar_thumbnails);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]