Commit 4562e884 authored by Iulian Radu's avatar Iulian Radu

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
parent 1d8b2e33
......@@ -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);
}
......
......@@ -315,7 +315,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);
......
......@@ -645,6 +645,7 @@ parse_rdf_item (EphyBookmarksManager *manager,
g_sequence_sort (tags, (GCompareDataFunc)ephy_bookmark_tags_compare, NULL);
bookmark = ephy_bookmark_new ((const char *)link, (const char *)title, tags);
ephy_bookmarks_manager_add_bookmark (manager, bookmark);
g_object_unref (bookmark);
} else {
g_sequence_free (tags);
}
......
......@@ -1078,6 +1078,7 @@ download_bookmark_response_cb (SoupSession *session,
!g_sequence_iter_is_end (iter); iter = g_sequence_iter_next (iter))
ephy_bookmarks_manager_create_tag (manager, g_sequence_get (iter));
g_object_unref (bookmark);
g_object_unref (parser);
out:
......@@ -1198,7 +1199,7 @@ sync_bookmarks_first_time_response_cb (SoupSession *session,
service = ephy_shell_get_sync_service (ephy_shell_get_default ());
manager = ephy_shell_get_bookmarks_manager (ephy_shell_get_default ());
bookmarks = ephy_bookmarks_manager_get_bookmarks (manager);
marked = g_hash_table_new (g_direct_hash, g_direct_equal);
marked = g_hash_table_new_full (g_direct_hash, g_direct_equal, g_object_unref, NULL);
parser = json_parser_new ();
json_parser_load_from_data (parser, msg->response_body->data, -1, NULL);
......@@ -1232,7 +1233,7 @@ sync_bookmarks_first_time_response_cb (SoupSession *session,
!g_sequence_iter_is_end (iter); iter = g_sequence_iter_next (iter))
ephy_bookmarks_manager_create_tag (manager, g_sequence_get (iter));
g_hash_table_add (marked, remote);
g_hash_table_add (marked, g_object_ref (remote));
}
/* If there is a local bookmark with the same url as the remote one, then
* merge tags into the local one, keep the remote id and upload it to the
......@@ -1246,8 +1247,7 @@ sync_bookmarks_first_time_response_cb (SoupSession *session,
ephy_bookmark_set_id (local, ephy_bookmark_get_id (remote));
ephy_sync_service_upload_bookmark (service, local, TRUE);
g_object_unref (remote);
g_hash_table_add (marked, local);
g_hash_table_add (marked, g_object_ref (local));
}
}
/* Having a local bookmark with the same id as the remote one means that the
......@@ -1263,15 +1263,16 @@ sync_bookmarks_first_time_response_cb (SoupSession *session,
!g_sequence_iter_is_end (iter); iter = g_sequence_iter_next (iter))
ephy_bookmarks_manager_create_tag (manager, g_sequence_get (iter));
g_hash_table_add (marked, remote);
g_hash_table_add (marked, g_object_ref (remote));
} else {
if (ephy_bookmark_get_modification_time (local) > ephy_bookmark_get_modification_time (remote))
ephy_sync_service_upload_bookmark (service, local, TRUE);
g_hash_table_add (marked, local);
g_object_unref (remote);
g_hash_table_add (marked, g_object_ref (local));
}
}
g_object_unref (remote);
}
/* Upload the remaining local bookmarks to the server. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment