[glib/freeze-shenanigans: 4/4] Handle a corner-case of notify avoidance




commit 9332f8331a0b1ac06c4a9891a66415b15ddb7b49
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Jun 8 14:09:45 2022 -0400

    Handle a corner-case of notify avoidance
    
    The corner-case we are handling here is that
    we don't freeze the notify queue in g_object_init
    (because there's no custom ->notify vfunc, but
    then we gain a notify handler during instance
    init, and instance init also triggers a
    notification. Handle this by jit freezing
    notification in g_object_notify_by_spec_internal.
    
    Note that this is bad code - instance init really
    shouldn't be doing things like this.
    
    Testcase included.
    
    Fixes: #2665

 gobject/gobject.c | 2 ++
 1 file changed, 2 insertions(+)
---
diff --git a/gobject/gobject.c b/gobject/gobject.c
index 74016a2426..1212b5ebaa 100644
--- a/gobject/gobject.c
+++ b/gobject/gobject.c
@@ -1441,7 +1441,9 @@ static inline void
 g_object_notify_by_spec_internal (GObject    *object,
                                   GParamSpec *pspec)
 {
+#ifdef HAVE_OPTIONAL_FLAGS
   guint object_flags;
+#endif
   gboolean has_notify;
   gboolean in_init;
 


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