diff options
author | Yi-Soo An <yisooan@gmail.com> | 2018-12-03 12:56:53 +0900 |
---|---|---|
committer | Yi-Soo An <yisooan@gmail.com> | 2018-12-03 12:56:53 +0900 |
commit | b4f25f6cf1c0b72400780a13a80b86a1232bb447 (patch) | |
tree | a350ec412f4b649776b5604e3f68fb532d5640d4 /src/bookmarks | |
parent | 3d437017e42213d41196cfbc4f80cf3a37d1011a (diff) | |
download | epiphany-b4f25f6cf1c0b72400780a13a80b86a1232bb447.tar.gz |
add-bookmark-popover: Use g_auto*
Use g_auto* instead of manually freeing resources.
Diffstat (limited to 'src/bookmarks')
-rw-r--r-- | src/bookmarks/ephy-add-bookmark-popover.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/bookmarks/ephy-add-bookmark-popover.c b/src/bookmarks/ephy-add-bookmark-popover.c index 3cdd198cf..0ba8159eb 100644 --- a/src/bookmarks/ephy-add-bookmark-popover.c +++ b/src/bookmarks/ephy-add-bookmark-popover.c @@ -210,17 +210,20 @@ ephy_add_bookmark_popover_show (EphyAddBookmarkPopover *self) bookmark = ephy_bookmarks_manager_get_bookmark_by_url (manager, address); if (!bookmark) { - char *id = ephy_sync_utils_get_random_sync_id (); - bookmark = ephy_bookmark_new (address, - ephy_embed_get_title (embed), - g_sequence_new (g_free), - id); + g_autofree char *id = NULL; + g_autoptr(EphyBookmark) new_bookmark = NULL; - ephy_bookmarks_manager_add_bookmark (manager, bookmark); + id = ephy_sync_utils_get_random_sync_id (); + new_bookmark = ephy_bookmark_new (address, + ephy_embed_get_title (embed), + g_sequence_new (g_free), + id); + + ephy_bookmarks_manager_add_bookmark (manager, new_bookmark); ephy_location_entry_set_bookmark_icon_state (location_entry, EPHY_LOCATION_ENTRY_BOOKMARK_ICON_BOOKMARKED); - g_object_unref (bookmark); - g_free (id); + + bookmark = new_bookmark; } g_signal_connect_object (manager, "bookmark-removed", |