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 603128 - Adding new UI that was recently removed may cause wrong order
Adding new UI that was recently removed may cause wrong order
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Class: UIManager / Actions
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
: 564864 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2009-11-27 10:32 UTC by Alexander Larsson
Modified: 2009-12-04 11:42 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Position new ui nodes correctly when existing dirty dead nodes exist (2.66 KB, patch)
2009-11-27 10:36 UTC, Alexander Larsson
committed Details | Review

Description Alexander Larsson 2009-11-27 10:32:12 UTC
Say you have AC in some place, now you remove those and add BC. The expected results is "BC", but with the current code you get CB.

The reason is that after you remove the initial items they are still in the tree as dirty until you gtk_ui_manager_ensure_update() or wait until idle. This means that when adding the new nodes the old nodes will be found in their old place and reused, whereas they would be appended or prepended (depending on user request) if the node had been removed first.

This causes e.g. nautilus extension menus to be essentially random order.
Comment 1 Alexander Larsson 2009-11-27 10:36:15 UTC
Created attachment 148581 [details] [review]
Position new ui nodes correctly when existing dirty dead nodes exist

If you add a new ui node that was recently removed it will still be
in the tree, but marked dirty. In this case we previously just used
the old node, which meant it wouldn't get the same position as if
the dirty nodes had been processed first (and deleted) before the
new node was added.

We handle this by detecting this case and reposition the node as if
it was new.
Comment 2 Matthias Clasen 2009-11-27 20:09:15 UTC
Comment on attachment 148581 [details] [review]
Position new ui nodes correctly when existing dirty dead nodes exist

Looks like a reasonable approach to me. The wording of the comment is slightly awkward though:

This node was removed but is still dirty so it was not removed yet.

Maybe say:

This node was removed, but is still dirty so it is still in the tree.
Comment 3 Alexander Larsson 2009-11-30 09:02:26 UTC
I'd like to put this on the stable branch too, is that ok?
Comment 4 Alexander Larsson 2009-11-30 13:23:35 UTC
put on gtk-2-18 branch too
Comment 5 Cosimo Cecchi 2009-12-04 11:42:14 UTC
*** Bug 564864 has been marked as a duplicate of this bug. ***