[glib/halfline/debug-metrics: 9/19] gobject: Don't crash if debug hash doesn't match expectations




commit 3e0949febc256bd3e0bb4d5cf660fd786b350fce
Author: Ray Strode <rstrode redhat com>
Date:   Mon May 10 10:25:27 2021 -0400

    gobject: Don't crash if debug hash doesn't match expectations
    
    At the moment if a GObject fails to chain up to finalize the object
    won't get removed from the hash at finalize time.
    
    This commit drops the assertions.

 gobject/gobject.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
---
diff --git a/gobject/gobject.c b/gobject/gobject.c
index 81a1162e9..d67987437 100644
--- a/gobject/gobject.c
+++ b/gobject/gobject.c
@@ -1064,7 +1064,6 @@ g_object_finalize (GObject *object)
   GOBJECT_IF_DEBUG (OBJECTS,
     {
       G_LOCK (debug_objects);
-      g_assert (g_hash_table_contains (debug_objects_ht, object));
       g_hash_table_remove (debug_objects_ht, object);
       debug_objects_count--;
       G_UNLOCK (debug_objects);
@@ -3345,7 +3344,7 @@ g_object_unref (gpointer _object)
            {
              /* catch objects not chaining finalize handlers */
              G_LOCK (debug_objects);
-             g_assert (!g_hash_table_contains (debug_objects_ht, object));
+             g_hash_table_remove (debug_objects_ht, object);
              G_UNLOCK (debug_objects);
            });
           g_type_free_instance ((GTypeInstance*) object);


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