After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 730045 - Avoid overeager warning about deprecated properties
Avoid overeager warning about deprecated properties
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2014-05-13 03:07 UTC by Matthias Clasen
Modified: 2014-05-13 12:10 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Avoid overeager warning about deprecated properties (1.58 KB, patch)
2014-05-13 03:07 UTC, Matthias Clasen
committed Details | Review

Description Matthias Clasen 2014-05-13 03:07:20 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.
Comment 1 Matthias Clasen 2014-05-13 03:07:27 UTC
Created attachment 276428 [details] [review]
Avoid overeager warning about deprecated properties
Comment 2 Matthias Clasen 2014-05-13 10:03:33 UTC
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
Comment 3 Allison Karlitskaya (desrt) 2014-05-13 11:58:57 UTC
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.
Comment 4 Matthias Clasen 2014-05-13 12:03:41 UTC
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.
Comment 5 Matthias Clasen 2014-05-13 12:10:00 UTC
Attachment 276428 [details] pushed as 4360756 - Avoid overeager warning about deprecated properties