GObject: allow G_PARAM_CONSTRUCT on any override

We were previously preventing implementations of an interface from
specifying G_PARAM_CONSTRUCT for a property of that interface if the
interface didn't specify it itself (or was readonly).

This is something that should only interest the implementation, so we
remove this restriction.

This allows 6 new possible override scenarios:

 - writable                 -> writable/construct
 - writable                 -> readwrite/construct
 - readwrite                -> readwrite/construct
 - writable/construct-only  -> writable/construct
 - writable/construct-only  -> readwrite/construct
 - readwrite/construct-only -> readwrite/construct

and we update the testcase to reflect this.

https://bugzilla.gnome.org/show_bug.cgi?id=666616
This commit is contained in:
Ryan Lortie
2011-12-20 19:33:02 -05:00
parent b3b9f82206
commit 4e793c2eef
2 changed files with 19 additions and 18 deletions

View File

@@ -1407,13 +1407,10 @@ object_interface_check_properties (gpointer func_data,
* If the interface was not writable to begin with then we don't
* really have any problems here because "writable at construct
* type only" is still more permissive than "read only".
*
* It's questionable if we should have G_PARAM_CONSTRUCT checked
* here....
*/
if (pspecs[n]->flags & G_PARAM_WRITABLE)
{
if (!SUBSET (class_pspec->flags, pspecs[n]->flags, G_PARAM_CONSTRUCT | G_PARAM_CONSTRUCT_ONLY))
if (!SUBSET (class_pspec->flags, pspecs[n]->flags, G_PARAM_CONSTRUCT_ONLY))
{
g_critical ("Flags for property '%s' on class '%s' introduce additional restrictions on "
"writability compared with the property on interface '%s'\n", pspecs[n]->name,