Merge lp:~chrisccoulson/libdbusmenu/set-cached-menuitem into lp:libdbusmenu/0.5

Proposed by Chris Coulson
Status: Merged
Merged at revision: 258
Proposed branch: lp:~chrisccoulson/libdbusmenu/set-cached-menuitem
Merge into: lp:libdbusmenu/0.5
Diff against target: 22 lines (+5/-0)
1 file modified
libdbusmenu-gtk/parser.c (+5/-0)
To merge this branch: bzr merge lp:~chrisccoulson/libdbusmenu/set-cached-menuitem
Reviewer Review Type Date Requested Status
Ted Gould (community) Approve
Review via email: mp+52624@code.launchpad.net

Description of the change

Whilst investigating bug 723463, I wrote a small Python test application which just rapidly added/removed menus from the menubar at random, and noticed that under most conditions, menus were not being removed from the menubar when being removed from the application.

Initially, it seemed this might be related to bug 723463, but after some more digging I realised this problem was actually occurring on the application side (I wasn't seeing menuitem_child_removed being called in DbusmenuServer, and other weird things were happening such as widget_notfy_cb was being called in the parser with pscpec=submenu, but no DbusmenuMenuitem associated with the widget).

Then, I realised that we never actually set CACHED_MENUITEM anywhere in the parser!

This branch fixes this. As a side-effect of this, calling dbusmenu_gtk_parse_menu_structure more than once on the same GtkWidget will result in the immediate children of that widget already having another DbusmenuMenuitem parent (the original root item), so we have to unreparent these where this happens.

To post a comment you must log in.
Revision history for this message
Chris Coulson (chrisccoulson) wrote :

Oh, this actually fixes bug 729128

Revision history for this message
Ted Gould (ted) wrote :

Heh, I actually had a branch fixing this. You Desktopers are too fast! I'll get you next time! :)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'libdbusmenu-gtk/parser.c'
--- libdbusmenu-gtk/parser.c 2011-03-01 17:41:58 +0000
+++ libdbusmenu-gtk/parser.c 2011-03-08 23:11:57 +0000
@@ -219,6 +219,7 @@
219219
220 pdata->widget = widget;220 pdata->widget = widget;
221 g_object_add_weak_pointer(G_OBJECT (widget), (gpointer*)&pdata->widget);221 g_object_add_weak_pointer(G_OBJECT (widget), (gpointer*)&pdata->widget);
222 g_object_set_data(G_OBJECT(widget), CACHED_MENUITEM, item);
222223
223 return item;224 return item;
224}225}
@@ -311,6 +312,10 @@
311312
312 /* Oops, let's tell our parents about us */313 /* Oops, let's tell our parents about us */
313 if (peek == NULL) {314 if (peek == NULL) {
315 if (dbusmenu_menuitem_get_parent(thisitem) != NULL) {
316 dbusmenu_menuitem_unparent(thisitem);
317 }
318
314 gint pos = get_child_position (widget);319 gint pos = get_child_position (widget);
315 if (pos >= 0)320 if (pos >= 0)
316 dbusmenu_menuitem_child_add_position (recurse->parent,321 dbusmenu_menuitem_child_add_position (recurse->parent,

Subscribers

People subscribed via source and target branches