GNOME Bugzilla – Bug 429970
AccelLabel does not reference AccelGroup
Last modified: 2014-08-30 05:07:49 UTC
GtkAccelLabel does not add a reference to the AccelGroup obtained from the accel closure. This leads to invalid g_signal_handlers_disconnect calls when the closure is unset from the AccelLabel and the group does not exist anymore. This happens when an ActionGroup is shared between multiple UI managers.
Created attachment 86379 [details] Testcase Testcase that uses a single ActionGroup for multiple UI managers. This prints warnings on the screen when the window (and with it the AccelLabels of the menu) are destroyed.
Created attachment 86381 [details] [review] Proposed patch Adds an extra reference to the AccelGroup.
May we commit this? It fixes a crash in the gtkmm wrapper.
I don't think this fix does the right thing. Sharing actions (or action groups) between ui managers is not going to work correctly anyway. If you look at gtk_action_set_accel_group(), the actions accelerator will be associated randomly with one of the ui managers accel_group.
Armin, does our original gtkmm test case use multiple UIManagers? If so, what is the person trying to achieve?
Yes, it does. The point is to put the same menu/toolbar (well, actually, menus with the same actions) into multiple windows.
But I guess this could be achieved by using one UIManager and one UI description, containing menu and toolbar descriptions that use the same action names. If the submitter's technique should not be allowed, I guess we should add a g_warning() to prevent it.
(In reply to comment #2) > Created an attachment (id=86381) [edit] > Proposed patch > > Adds an extra reference to the AccelGroup. [not commenting on the UI manager issue] the accel label shouldn't need to forefully keep an accel group alive, if this really needs fixing on the accel label side, you can use g_signal_connect_data() instead + a destroy handler that resets accel_label->accel_group to NULL.
GtkAction has been deprecated