[glib/fix-freeze-count-underflow: 7/7] gobject: Don't thaw excessively




commit cb4d1710759acca47ccf0f93a2a9e9bfd2e924b5
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Jun 8 13:29:38 2022 -0400

    gobject: Don't thaw excessively
    
    We need to match the conditions in g_object_init
    for when we already have a freeze. Without that,
    we underflow the freeze count and trigger a
    warning.
    
    Fixes: #2666

 gobject/gobject.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/gobject/gobject.c b/gobject/gobject.c
index f19c40180e..e71547c19a 100644
--- a/gobject/gobject.c
+++ b/gobject/gobject.c
@@ -2128,7 +2128,7 @@ g_object_new_with_custom_constructor (GObjectClass          *class,
       /* Remember: if it was newly_constructed then g_object_init()
        * already did a freeze, so we now have two.  Release one.
        */
-      if (newly_constructed)
+      if (newly_constructed && CLASS_HAS_NOTIFY (class))
         g_object_notify_queue_thaw (object, nqueue);
     }
 


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