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 150877 - should warn about duplicate actions
should warn about duplicate actions
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Class: UIManager / Actions
2.4.x
Other Linux
: Normal normal
: Small fix
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2004-08-23 19:06 UTC by Tommi Komulainen
Modified: 2007-05-19 04:06 UTC
See Also:
GNOME target: ---
GNOME version: 2.5/2.6


Attachments
Patch to refuse duplicate actions (3.74 KB, patch)
2007-03-20 21:18 UTC, Kalle Vahlman
none Details | Review

Description Tommi Komulainen 2004-08-23 19:06:19 UTC
GtkUIManager and/or GtkActionGroup should warn when inserting duplicate actions
with the same name.  Doing so apparently confuses gtk_ui_manager_remove_ui()
(see bug 150803)
Comment 1 Kalle Vahlman 2007-03-20 21:18:31 UTC
Created attachment 85008 [details] [review]
Patch to refuse duplicate actions

This patch makes GtkActionGroup refuse to accept non-unique actions and emit a warning about it. Also modifies the testactions tester to have duplicate actions in the action entries to test this.

Internally the actions are kept in a hash table, keyed with the action name. So currently, if one adds a duplicate action to the group, the old one will get discarded. This seems to confuse GtkUIManager a bit as seen in bug 150803 (I guess that the signal gets emitted for the action that had been discarded, but had refcount > 1 at that time and was kept a pointer to within uimanager).

As actions are identified primarily by their name, rejecting duplicates seems to be the right thing to do conceptually too.
Comment 2 Kalle Vahlman 2007-03-20 21:19:11 UTC

*** This bug has been marked as a duplicate of 362578 ***
Comment 3 Kalle Vahlman 2007-03-20 21:20:09 UTC
Arg, sorry for fumbling around
Comment 4 Matthias Clasen 2007-05-19 04:06:35 UTC
2007-05-18  Matthias Clasen  <mclasen@redhat.com>

        * gtk/gtkactiongroup.c: Warn and refuse to add actions with
        duplicate names.  (#150877, Tommi Komulainen)