GNOME Bugzilla – Bug 776278
status-notifier: activation loop on toggle items
Last modified: 2016-12-20 15:04:06 UTC
Created attachment 342220 [details] [review] status-notifier: avoid activation loop on toggle items Currently there is no guard against sending the activate signal over DBus in response to updating the item locally. This is a problem for check and radio menu items that emit the activate signal locally then their state toggles, which leads to sending the even over to the application. In return, the application will see a toggling event and notify the SNI again -- infinite loop. This is visible e.g. in Mumble when activating either of the toggle items, which leads to endless toggling. I'm not too happy with the implementation here, but it's the most straightforward one I thought of that doesn't add code duplication and doesn't require a bunch of indirection just for that.
Review of attachment 342220 [details] [review]: ::: modules/external/status-notifier/sn-dbus-menu-item.c @@ +371,3 @@ + if (item->activate_handler != 0) + g_signal_handler_block (item->item, item->activate_handler); Don't use if, it looks like signal id can be 0 only if we use invalid signal name with g_signal_connect. ::: modules/external/status-notifier/sn-dbus-menu-item.h @@ +47,3 @@ GtkMenu *submenu; + + gulong activate_handler; Please use activate_id. ::: modules/external/status-notifier/sn-dbus-menu.c @@ +102,3 @@ g_object_set_data (G_OBJECT (item->item), "item-id", GUINT_TO_POINTER (id)); gtk_menu_shell_append (GTK_MENU_SHELL (gtk_menu), item->item); + item->activate_handler = g_signal_connect (item->item, "activate", Please add empty line above this.
Created attachment 342261 [details] [review] status-notifier: avoid activation loop on toggle items Updated patch following review
Thanks!