bug in xml merging code.
- From: Mathieu Lacage <mathieu eazel com>
- To: gnome-components-list gnome org
- Subject: bug in xml merging code.
- Date: 08 Oct 2000 17:33:02 -0700
hi,
I have been trying to fix some misc bugs in nautilus related to the bonobo
new menu merging code.. One of them involves changing the icon of a toplevel
'submenu' item. (although hte problem as described below is not related to
icon since changing the label name of any toplevel 'submenu' item has the
same effect)
If you change an attribute of a toplevel 'submenu' item, (ie:
bonobo_ui_component_set_attr (component, "attrname", "value")),
bonobo will do 2 things:
- during the xml merging of the main xml tree and the small
xml fragment resulting from this function call (in bonobo-ui-xml.c
function (merge)), it replaces the original toplevel 'submenu' item
by the 'submenu' item of the xml fragment. ie: it actually
switches pointers so that the original toplevel 'submenu' items
have a new sibbling pointer.
- after xml merging, and during the updating of the widget tree from
the xml tree, the code behaves as folows: if it finds a widget which
has a pointer to an xmlNode which is not in the xml tree (yes, each
widget holds a pointer to its corresponding xml node and vice-versa)
it decides to rebuild the widget from scratch and then reinserts it
in the widget hierarchy. This has the side effect here of leaving
the old toplevel 'submenu' item in the menu tree and duplicating
the widgets since the code does not destroy the old widget.
The relevant code for this is in (bonobo-win.c, function
sync_generic_widgets. The important line is :
same = (b != NULL) && (widget_get_node (b->data) == a);
this piece of code tests if the current widget (b->data) has an xml
Node pointer (widget_get_node (b->data)) equal to the current xml
node (a). In our case, it does not happen because we changed the
pointer to the relevant xml node in teh xml tree although the data
has not fundamentaly changed.
I am not clear what the correct behaviour should be but my feeling is that the
xml merging code should be more conservative and it should not overide the
xmlNode pointer but it should move the attributes of the new node into the
old one...
So, I am sorry but I have been unable to fix this bug since I could not figure
out how the current code works: the 'merge' function and 'overide_with_node'
function are really misterious... Rewriting all the xml menu merging code is
probably what I will do if no one fixes this problem but I hope someone will
find the bug here :)
Mathieu
--
Mathieu Lacage <mathieu eazel com>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]