[glib] GObject: turn add-property-after-init to a warning



commit c1e32a5c59cf43d86c6e1b50ba570e01a549c026
Author: Ryan Lortie <desrt desrt ca>
Date:   Mon Jun 10 11:14:17 2013 -0400

    GObject: turn add-property-after-init to a warning
    
    We have turned up enough cases of this being done (including GTK API
    allowing apps to do this to GtkSettings well after it has been
    instantiated) that it is clear that we cannot really break this feature
    while claiming to be backwards compatible.
    
    For that reason, it becomes a warning rather than a critical (ie: it is
    still well-defined behaviour, but you are discouraged from doing it).
    
    The intention is to keep this feature for at least the next while.
    A given GObjectClass will be able to avoid using GParamSpec pool for as
    long as you don't install properties after init.  If you do that, you
    will get a warning and we will devolve to using GParamSpecPool.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=698614

 gobject/gobject.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/gobject/gobject.c b/gobject/gobject.c
index c22b655..d843d57 100644
--- a/gobject/gobject.c
+++ b/gobject/gobject.c
@@ -543,7 +543,7 @@ g_object_class_install_property (GObjectClass *class,
     g_error ("Attempt to add property %s::%s to class after it was derived", G_OBJECT_CLASS_NAME (class), 
pspec->name);
 
   if (!g_type_is_in_init (G_OBJECT_CLASS_TYPE (class)))
-    g_critical ("Attempt to add property %s::%s after class was initialised", G_OBJECT_CLASS_NAME (class), 
pspec->name);
+    g_warning ("Attempt to add property %s::%s after class was initialised", G_OBJECT_CLASS_NAME (class), 
pspec->name);
 
   class->flags |= CLASS_HAS_PROPS_FLAG;
 
@@ -656,7 +656,7 @@ g_object_class_install_properties (GObjectClass  *oclass,
              G_OBJECT_CLASS_NAME (oclass));
 
   if (!g_type_is_in_init (G_OBJECT_CLASS_TYPE (oclass)))
-    g_critical ("Attempt to add properties %s after it was initialised", G_OBJECT_CLASS_NAME (oclass));
+    g_warning ("Attempt to add properties to %s after it was initialised", G_OBJECT_CLASS_NAME (oclass));
 
   oclass_type = G_OBJECT_CLASS_TYPE (oclass);
   parent_type = g_type_parent (oclass_type);


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