gobject: Don’t warn when setting deprecated construct property defaults

The default values for construct properties always have to be set, even
if those properties are deprecated. The code to do that is in GLib, and
not under the control of the user (unless they completely override the
`constructor` vfunc, which is not recommended). So don’t emit a warning
for that if `G_ENABLE_DIAGNOSTICS` is enabled.

In particular, this fixes deprecation warnings being emitted for
properties of a parent class when chaining up with a custom constructor,
even when none of the child class code mentions the deprecated property.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Fixes: #3254
This commit is contained in:
Philip Withnall 2024-02-26 13:47:36 +00:00
parent 15202c970a
commit df5aa217e4
No known key found for this signature in database
GPG Key ID: DCDF5885B1F3ED73

View File

@ -2992,7 +2992,7 @@ g_object_constructor (GType type,
GParamSpec *pspec = construct_params->pspec;
construct_params++;
object_set_property (object, pspec, value, nqueue, TRUE);
object_set_property (object, pspec, value, nqueue, FALSE);
}
g_object_notify_queue_thaw (object, nqueue, FALSE);
/* the notification queue is still frozen from g_object_init(), so