[epiphany/mcatanzaro/more-leaks: 4/5] find-toolbar: simplify dispose




commit a21e4b969994e66dcc1b25d16842d8d7be0e1e34
Author: Michael Catanzaro <mcatanzaro redhat com>
Date:   Fri Sep 16 14:00:27 2022 -0500

    find-toolbar: simplify dispose
    
    g_clear_handler_id() is good, and g_cancellable_cancel() is NULL-safe.
    
    Part-of: <https://gitlab.gnome.org/GNOME/epiphany/-/merge_requests/1193>

 embed/ephy-find-toolbar.c | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)
---
diff --git a/embed/ephy-find-toolbar.c b/embed/ephy-find-toolbar.c
index 33eb9a114..e46a4311f 100644
--- a/embed/ephy-find-toolbar.c
+++ b/embed/ephy-find-toolbar.c
@@ -412,20 +412,11 @@ ephy_find_toolbar_dispose (GObject *object)
 {
   EphyFindToolbar *toolbar = EPHY_FIND_TOOLBAR (object);
 
-  if (toolbar->find_again_source_id != 0) {
-    g_source_remove (toolbar->find_again_source_id);
-    toolbar->find_again_source_id = 0;
-  }
-
-  if (toolbar->find_source_id != 0) {
-    g_source_remove (toolbar->find_source_id);
-    toolbar->find_source_id = 0;
-  }
+  g_clear_handle_id (&toolbar->find_again_source_id, g_source_remove);
+  g_clear_handle_id (&toolbar->find_source_id, g_source_remove);
 
-  if (toolbar->cancellable) {
-    g_cancellable_cancel (toolbar->cancellable);
-    g_clear_object (&toolbar->cancellable);
-  }
+  g_cancellable_cancel (toolbar->cancellable);
+  g_clear_object (&toolbar->cancellable);
 
   G_OBJECT_CLASS (ephy_find_toolbar_parent_class)->dispose (object);
 }


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