GNOME Bugzilla – Bug 730045
Avoid overeager warning about deprecated properties
Last modified: 2014-05-13 12:10:04 UTC
Construct properties are always set during construction. It makes no sense to warn about this even if the property is marked as deprecated; the deprecation warning should only be issues for explicit uses of the property after construction.
Created attachment 276428 [details] [review] Avoid overeager warning about deprecated properties
to see the problem that is fixed here in action, run G_ENABLE_DEBUG=1 gtk3-demo you'll get lots of spam about ::use-stock - not because that property is used in gtk3-demo, but because it is a construct property
Review of attachment 276428 [details] [review]: Looks fine, but I'm pretty sure you can simplify the condition. ::: gobject/gobject.c @@ +1349,3 @@ { + if (!(pspec->flags & (G_PARAM_CONSTRUCT | G_PARAM_CONSTRUCT_ONLY)) || + !object_in_construction (object)) Why not just check for !in_construction() here? Do the 'deprecated' check first, though -- it's faster, and it's almost always going to be false.
I thought it would be useful to warn if a non-construct property gets explicitly specified at construction time like this: g_object_new (TYPE_BLA, "some-deprecated-prop", value, NULL) I just don't want to warn if you do g_object_new (TYPE_BLA, NULL) and some construct property gets added behind your back.
Attachment 276428 [details] pushed as 4360756 - Avoid overeager warning about deprecated properties