[epiphany/wip/sync] bookmarks-manager: Change *_add_bookmark() to be (transfer none)



commit d4d00b6cbf5284910ea297baf689f1f11fe0beb4
Author: Iulian Radu <iulian radu67 gmail com>
Date:   Fri Mar 31 19:02:09 2017 +0300

    bookmarks-manager: Change *_add_bookmark() to be (transfer none)
    
    This should fix the inconsistency between *_add_bookmarks() and
    *_add_bookmark().
    
    https://bugzilla.gnome.org/show_bug.cgi?id=780564

 src/bookmarks/ephy-add-bookmark-popover.c    |    1 +
 src/bookmarks/ephy-bookmarks-manager.c       |    9 ++++-----
 src/profile-migrator/ephy-profile-migrator.c |    1 +
 3 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/src/bookmarks/ephy-add-bookmark-popover.c b/src/bookmarks/ephy-add-bookmark-popover.c
index d9054c7..06b2cb9 100644
--- a/src/bookmarks/ephy-add-bookmark-popover.c
+++ b/src/bookmarks/ephy-add-bookmark-popover.c
@@ -73,6 +73,7 @@ ephy_add_bookmark_popover_finalize (GObject *object)
 
   if (self->address)
     g_free (self->address);
+  g_object_unref (self->bookmark);
 
   G_OBJECT_CLASS (ephy_add_bookmark_popover_parent_class)->finalize (object);
 }
diff --git a/src/bookmarks/ephy-bookmarks-manager.c b/src/bookmarks/ephy-bookmarks-manager.c
index c3a0a27..bf30838 100644
--- a/src/bookmarks/ephy-bookmarks-manager.c
+++ b/src/bookmarks/ephy-bookmarks-manager.c
@@ -295,6 +295,7 @@ synchronizable_manager_add (EphySynchronizableManager *manager,
 
   ephy_bookmarks_manager_add_bookmark (self, bookmark);
   ephy_bookmarks_manager_create_tags_from_bookmark (self, bookmark);
+  g_object_unref (bookmark);
 }
 
 static void
@@ -358,7 +359,6 @@ handle_updated:
     /* Ignore mobile/unfiled bookmarks and everything that is not bookmark. */
     if (g_strcmp0 (type, "bookmark") ||
         (!g_strcmp0 (parent_id, "mobile") || !g_strcmp0 (parent_id, "unfiled"))) {
-      g_object_unref (remote);
       goto next;
     }
 
@@ -380,9 +380,6 @@ handle_updated:
       } else if (ephy_bookmark_get_modification_time (local) > ephy_bookmark_get_modification_time (remote)) 
{
         ephy_bookmarks_manager_create_tags_from_bookmark (self, remote);
         *to_upload = g_list_prepend (*to_upload, local);
-        g_object_unref (remote);
-      } else {
-        g_object_unref (remote);
       }
     }
 
@@ -390,6 +387,7 @@ handle_updated:
 next:
     g_free(type);
     g_free(parent_id);
+    g_object_unref (remote);
   }
 
   /* Upload unhandled bookmarks to server. */
@@ -524,7 +522,8 @@ ephy_bookmarks_manager_add_bookmark (EphyBookmarksManager *self,
   g_return_if_fail (EPHY_IS_BOOKMARKS_MANAGER (self));
   g_return_if_fail (EPHY_IS_BOOKMARK (bookmark));
 
-  iter = ephy_bookmarks_search_and_insert_bookmark (self->bookmarks, bookmark);
+  iter = ephy_bookmarks_search_and_insert_bookmark (self->bookmarks,
+                                                    g_object_ref (bookmark));
   if (iter) {
     /* Update list */
     position = g_sequence_iter_get_position (iter);
diff --git a/src/profile-migrator/ephy-profile-migrator.c b/src/profile-migrator/ephy-profile-migrator.c
index 9c44247..0be42eb 100644
--- a/src/profile-migrator/ephy-profile-migrator.c
+++ b/src/profile-migrator/ephy-profile-migrator.c
@@ -650,6 +650,7 @@ parse_rdf_item (EphyBookmarksManager *manager,
     ephy_bookmarks_manager_add_bookmark (manager, bookmark);
 
     g_free (id);
+    g_object_unref (bookmark);
   } else {
     g_sequence_free (tags);
   }


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