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 666615 - loosen property override flag restrictions
loosen property override flag restrictions
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gobject
unspecified
Other All
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2011-12-20 19:43 UTC by Allison Karlitskaya (desrt)
Modified: 2011-12-20 19:58 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gobject: loosen property override flag restrictions (2.23 KB, patch)
2011-12-20 19:43 UTC, Allison Karlitskaya (desrt)
committed Details | Review
GAction: back out changes to property flags (3.07 KB, patch)
2011-12-20 19:47 UTC, Allison Karlitskaya (desrt)
committed Details | Review

Description Allison Karlitskaya (desrt) 2011-12-20 19:43:39 UTC
This change is controversial, so review is appreciated.
Comment 1 Allison Karlitskaya (desrt) 2011-12-20 19:43:40 UTC
Created attachment 203979 [details] [review]
gobject: loosen property override flag restrictions

GObject enforces the following restrictions on property overrides:

  - must only add abilities: if the parent class supports
    readability/writability then the subclass must also support them.
    Subclasses are free to add readability/writability.

  - must not add additional restrictions: if the parent class doesn't
    have construct/construct-only restrictions then the subclass must
    not add them.  Subclasses are free to remove restrictions.

The problem with the previous implementation is that the check against
adding construct/construct-only restrictions was being done even if the
property was not previously writable.  As an example:

  "readable" and "writable only on construct"

was considered as being more restrictive than

  "read only".

This patch tweaks the check to allow the addition of
construct/construct-only restrictions for properties that were
previously read-only and are now being made writable.
Comment 2 Allison Karlitskaya (desrt) 2011-12-20 19:47:17 UTC
Created attachment 203980 [details] [review]
GAction: back out changes to property flags

41e5ba86a791a17bb560dd7813ad7e849e0230dc introduced some changes to the
property flags of GAction.  These changes were not a reflection of the
actual interface of GAction but were necessary due to GObject being
overly-sensitive to flag changes on property overrides.

Now that the GObject bug is fixed, we can restore the GAction flags to
their correct values.
Comment 3 Matthias Clasen 2011-12-20 19:54:44 UTC
Review of attachment 203979 [details] [review]:

No objections to this. I was not following the irc discussion closely enough, it seems.
Comment 4 Colin Walters 2011-12-20 19:58:39 UTC
Review of attachment 203979 [details] [review]:

The commit message is excellent.   Following the logic in the implementation is a little awkward with deeply nested negations and && and || mixed with bit logic |.  Maybe split it out like:

if (class_pspec)
 { 
   if (pspecs[n]->flags & WRITABLE)
    {
      if (!SUBSET()) { error }
    }
   if (!SUBSET()) { error }

}

?
Comment 5 Allison Karlitskaya (desrt) 2011-12-20 19:58:51 UTC
Attachment 203979 [details] pushed as af24dbc - gobject: loosen property override flag restrictions
Attachment 203980 [details] pushed as ebf572c - GAction: back out changes to property flags