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
This commit is contained in:
Ryan Lortie 2013-06-10 11:14:17 -04:00
parent bbf9f5e97c
commit c1e32a5c59

View File

@ -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);