[epiphany] Fix memory management of get_by_tags



commit f09f3ad9fb719f8c0f7a7eb59fdb34dce0106ded
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Tue Nov 1 11:42:47 2016 -0500

    Fix memory management of get_by_tags
    
    We need to ref all the bookmarks that we put into this container. It
    wasn't crashing because we accidentally leaked the container.

 src/bookmarks/ephy-bookmarks-manager.c |    4 ++--
 src/bookmarks/ephy-bookmarks-popover.c |    2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/src/bookmarks/ephy-bookmarks-manager.c b/src/bookmarks/ephy-bookmarks-manager.c
index 4136892..f7b3320 100644
--- a/src/bookmarks/ephy-bookmarks-manager.c
+++ b/src/bookmarks/ephy-bookmarks-manager.c
@@ -525,7 +525,7 @@ ephy_bookmarks_manager_get_bookmarks_with_tag (EphyBookmarksManager *self,
 
       if (g_sequence_is_empty (ephy_bookmark_get_tags (bookmark))) {
         g_sequence_insert_sorted (bookmarks,
-                                  bookmark,
+                                  g_object_ref (bookmark),
                                   (GCompareDataFunc)ephy_bookmark_bookmarks_sort_func,
                                   NULL);
       }
@@ -538,7 +538,7 @@ ephy_bookmarks_manager_get_bookmarks_with_tag (EphyBookmarksManager *self,
 
       if (ephy_bookmark_has_tag (bookmark, tag))
         g_sequence_insert_sorted (bookmarks,
-                                  bookmark,
+                                  g_object_ref (bookmark),
                                   (GCompareDataFunc)ephy_bookmark_bookmarks_sort_func,
                                   NULL);
     }
diff --git a/src/bookmarks/ephy-bookmarks-popover.c b/src/bookmarks/ephy-bookmarks-popover.c
index bf96aad..0b89d28 100644
--- a/src/bookmarks/ephy-bookmarks-popover.c
+++ b/src/bookmarks/ephy-bookmarks-popover.c
@@ -376,6 +376,8 @@ ephy_bookmarks_popover_show_tag_detail (EphyBookmarksPopover *self,
 
   gtk_stack_set_visible_child_name (GTK_STACK (self->toplevel_stack),
                                     "tag_detail");
+
+  g_sequence_free (bookmarks);
 }
 
 static void


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