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 723517 - Fix critical messages in GPropertyAction and GSimpleActionGroup
Fix critical messages in GPropertyAction and GSimpleActionGroup
Status: RESOLVED OBSOLETE
Product: glib
Classification: Platform
Component: gio
2.39.x
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
: 724450 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2014-02-03 07:41 UTC by Sébastien Wilmet
Modified: 2018-05-24 16:16 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
GPropertyAction: avoid a critical message (910 bytes, patch)
2014-02-03 07:41 UTC, Sébastien Wilmet
rejected Details | Review
GSimpleActionGroup: avoid a critical message (864 bytes, patch)
2014-02-03 07:41 UTC, Sébastien Wilmet
rejected Details | Review
patch (1.07 KB, patch)
2014-02-15 10:20 UTC, Paolo Borelli
none Details | Review
gedit workaround (4.13 KB, patch)
2014-02-16 21:47 UTC, Paolo Borelli
none Details | Review

Description Sébastien Wilmet 2014-02-03 07:41:13 UTC
See the attached patches.
Comment 1 Sébastien Wilmet 2014-02-03 07:41:45 UTC
Created attachment 267922 [details] [review]
GPropertyAction: avoid a critical message

g_settings_set_mapping() can return NULL in valid cases, but
g_variant_ref_sink() doesn't support NULL.
Comment 2 Sébastien Wilmet 2014-02-03 07:41:49 UTC
Created attachment 267923 [details] [review]
GSimpleActionGroup: avoid a critical message
Comment 3 Allison Karlitskaya (desrt) 2014-02-03 09:18:38 UTC
Review of attachment 267923 [details] [review]:

The state change can never be to NULL -- actions must always either have a NULL state (which never changes) or have a state which will change between values of the same type, but never to NULL.

Therefore this patch doesn't make sense.
Comment 4 Allison Karlitskaya (desrt) 2014-02-03 09:19:49 UTC
Review of attachment 267922 [details] [review]:

The interface of GAction is that a stateful action must always have a state of the expected type -- never NULL.  We therefore must always return a value of the correct type from this function.
Comment 5 Allison Karlitskaya (desrt) 2014-02-03 09:22:13 UTC
Thank you for looking into this problem (which I agree is a problem).  The approach in the proposed patches isn't sufficient, though.

I think we should maybe figure out a way to either do the following:

  (a) apply some stricter checks for type compatibility on construction and
      possibly fail to construct it if we can't always guarantee it

  (b) return a GVariant with some sort of 'default value' in the case that we
      get NULL from the GSettings mapping
Comment 6 Sébastien Wilmet 2014-02-03 09:24:19 UTC
The critical messages occur with gedit master, so there is maybe something wrong on the gedit side.
Comment 7 Sébastien Wilmet 2014-02-14 20:28:11 UTC
I've just written the patches because I thought it was trivial. But I don't really plan to work on this.
Comment 8 Paolo Borelli 2014-02-14 21:34:59 UTC
on the gedit side this is triggered by

action = g_property_action_new ("set-visible-child", priv->stack, "visible-child-name");
g_action_map_add_action (G_ACTION_MAP (priv->action_group), G_ACTION (action));

in the menu-stack-switcher.

Could it be that it does not like the initial NULL value of the property?
Comment 9 Paolo Borelli 2014-02-15 10:20:50 UTC
Created attachment 269191 [details] [review]
patch

What about this instead?
Comment 10 Paolo Borelli 2014-02-16 08:48:37 UTC
*** Bug 724450 has been marked as a duplicate of this bug. ***
Comment 11 Allison Karlitskaya (desrt) 2014-02-16 18:42:25 UTC
Review of attachment 269191 [details] [review]:

This patch is evil... but less evil than the other one.

I'd still like to try to find a better solution -- probably on the gedit side.

The crux of this issue is that if this property is NULL then we cannot have a property action for it.  That probably boils down to us having to create/destroy the property action as the stack enters/leaves states where NULL is a possible value.  I guess that means we create the action when there are pages to switch and destroy it again when the last page is gone.  That even sort of makes sense logically...
Comment 12 Paolo Borelli 2014-02-16 21:47:17 UTC
Created attachment 269336 [details] [review]
gedit workaround

This is the gedit workaround of initting lazily.

It works, but we still get the criticals on shutdown.

Bug #724506 has a gtk patch to work around the other side of the issue.



This is serious engineering work, original designers of the Pisa tower would be proud
Comment 13 Allison Karlitskaya (desrt) 2014-02-16 21:50:57 UTC
Review of attachment 269336 [details] [review]:

I'm happier with this. :)
Comment 14 Paolo Borelli 2014-02-18 11:30:56 UTC
I gave up and reimplemented the switcher not using GPropertyAction at all (since it also fits the visual design requirements better), so the gedit critical is fixed.

That said I still think this should be addressed in GProperyAction: we may like it or not, but a GParamSpec for strings can be NULL so string properties are always "ms" imho... I have a half done patch for the g_property_action_new_wit_type, but it didn't fix the issue so I did not pursue it, if needed I can attach it
Comment 15 GNOME Infrastructure Team 2018-05-24 16:16:32 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/glib/issues/826.