[epiphany] bookmarks-manager: Fix bookmark removal not working properly



commit 23a9332cf172a5bd0ffd057b63c3e55836ce047d
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Mon Jan 16 20:33:25 2017 -0600

    bookmarks-manager: Fix bookmark removal not working properly
    
    The list model never removes the bookmark right away, it's not being
    removed until the second time this signal is emitted after the removal,
    because we are performing the operations in the wrong order. This signal
    is named "bookmark-removed", not "will-remove-bookmark", so actually
    remove it first before emitting it.

 src/bookmarks/ephy-bookmarks-manager.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/src/bookmarks/ephy-bookmarks-manager.c b/src/bookmarks/ephy-bookmarks-manager.c
index c9f8787..6912507 100644
--- a/src/bookmarks/ephy-bookmarks-manager.c
+++ b/src/bookmarks/ephy-bookmarks-manager.c
@@ -261,8 +261,14 @@ ephy_bookmarks_manager_remove_bookmark (EphyBookmarksManager *self,
       break;
   }
 
-  g_signal_emit (self, signals[BOOKMARK_REMOVED], 0, bookmark);
+  /* Ensure the bookmark is removed from our list before the signal is emitted,
+   * because this is the bookmark REMOVED signal after all, so callers expect
+   * it to be already gone.
+   */
+  g_object_ref (bookmark);
   g_sequence_remove (iter);
+  g_signal_emit (self, signals[BOOKMARK_REMOVED], 0, bookmark);
+  g_object_unref (bookmark);
 
   ephy_bookmarks_manager_save_to_file_async (self, NULL,
                                              
(GAsyncReadyCallback)ephy_bookmarks_manager_save_to_file_warn_on_error_cb,


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