GNOME Bugzilla – Bug 603128
Adding new UI that was recently removed may cause wrong order
Last modified: 2009-12-04 11:42:14 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.
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 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.
I'd like to put this on the stable branch too, is that ok?
put on gtk-2-18 branch too
*** Bug 564864 has been marked as a duplicate of this bug. ***