diff options
author | Ted Gould <ted@gould.cx> | 2010-02-05 09:47:16 -0800 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2010-02-05 09:47:16 -0800 |
commit | 919aa5eca6bdc79bdb9276aa499c5b612cc28c4d (patch) | |
tree | 3af6aa1030cbb6a8781831fe36308fc10b2ad832 | |
parent | da41d4b9f71260928d68bee40106bc68e4624023 (diff) | |
download | libdbusmenu-919aa5eca6bdc79bdb9276aa499c5b612cc28c4d.tar.gz libdbusmenu-919aa5eca6bdc79bdb9276aa499c5b612cc28c4d.tar.bz2 libdbusmenu-919aa5eca6bdc79bdb9276aa499c5b612cc28c4d.zip |
Managing the root value and the referencing the old root item.
-rw-r--r-- | libdbusmenu-glib/client.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index d63278d..b69e984 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -737,6 +737,10 @@ parse_layout (DbusmenuClient * client, const gchar * layout) xmlNodePtr root = xmlDocGetRootElement(xmldoc); DbusmenuMenuitem * oldroot = priv->root; + if (oldroot != NULL) { + g_object_ref(oldroot); + } + priv->root = parse_layout_xml(client, root, priv->root, NULL, priv->menuproxy); xmlFreeDoc(xmldoc); @@ -752,8 +756,11 @@ parse_layout (DbusmenuClient * client, const gchar * layout) /* Switch the root around */ g_object_ref(priv->root); dbusmenu_menuitem_set_root(priv->root, TRUE); - dbusmenu_menuitem_set_root(oldroot, FALSE); - g_object_unref(oldroot); + + if (oldroot != NULL) { + dbusmenu_menuitem_set_root(oldroot, FALSE); + g_object_unref(oldroot); + } g_signal_emit(G_OBJECT(client), signals[ROOT_CHANGED], 0, priv->root, TRUE); } |