appindicator ignores menu entries after having sent the menu to the indicator

Bug #1203888 reported by Jeremy Bicha on 2013-07-22
248
This bug affects 50 people
Affects Status Importance Assigned to Milestone
DBus Menu
Fix Committed
Undecided
Unassigned
Glipper
Undecided
Unassigned
libdbusmenu (Ubuntu)
High
Unassigned
Saucy
High
Unassigned

Bug Description

Impact: some indicator menus are incomplete

Test Case: see comment #8

Regression potential:
Check that your menus still work correctly, the change is only impacting gtk2 and renaming from a signal that was dropped to an existant one, it shouldn't create any issue

---------------------------

On Saucy, the glipper appindicator shows but none of its menu items show up when left or right-clicking on it.

$ glipper
SHARED_DATA_DIR: /usr/share/glipper
Binding shortcut <Ctrl><Alt>c to popup glipper
Changed process name to: glipper
/usr/lib/python2.7/dist-packages/glipper/AppIndicator.py:43: Warning: /build/buildd/glib2.0-2.37.3/./gobject/gsignal.c:2475: signal 'child-added' is invalid for instance '0x20c90f0' of type 'GtkMenu'
  self._app_indicator.set_menu(self.menu)

(glipper:20249): LIBDBUSMENU-GLIB-WARNING **: About to Show called on an item wihtout submenus. We're ignoring it.

ProblemType: Bug
DistroRelease: Ubuntu 13.10
Package: glipper 2.4-3
ProcVersionSignature: Ubuntu 3.10.0-4.13-generic 3.10.1
Uname: Linux 3.10.0-4-generic x86_64
ApportVersion: 2.11-0ubuntu1
Architecture: amd64
Date: Mon Jul 22 18:17:16 2013
InstallationDate: Installed on 2013-06-14 (38 days ago)
InstallationMedia: Ubuntu-GNOME 13.10 "Saucy Salamander" - Alpha amd64 (20130613)
MarkForUpload: True
PackageArchitecture: all
SourcePackage: glipper
UpgradeStatus: No upgrade log present (probably fresh install)

Related branches

Jeremy Bicha (jbicha) wrote :

klipper doesn't work either, although the terminal give no error messages.

Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in glipper (Ubuntu):
status: New → Confirmed
Alistair Buxton (a-j-buxton) wrote :

Identical problem with blueman-applet:

__load_plugin (/usr/lib/python2.7/dist-packages/blueman/main/PluginManager.py:142)
loading <class 'blueman.plugins.applet.AppIndicator.AppIndicator'>
/usr/lib/python2.7/dist-packages/blueman/plugins/applet/AppIndicator.py:44: Warning: /build/buildd/glib2.0-2.37.6/./gobject/gsignal.c:2475: signal 'child-added' is invalid for instance '0x193d0b0' of type 'GtkMenu'
  self.indicator.set_menu(applet.Plugins.Menu.get_menu())
_________

Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in blueman (Ubuntu):
status: New → Confirmed
Alistair Buxton (a-j-buxton) wrote :

Actually it looks a lot like python-appindicator is broken. Following code demonstrates the bug:

#!/usr/bin/env python

import gtk
import appindicator

m = gtk.Menu()
m.append(gtk.MenuItem('Hello'))

a = appindicator.Indicator('test', '', appindicator.CATEGORY_APPLICATION_STATUS)
a.set_status(appindicator.STATUS_ACTIVE)
a.set_menu(m)

gtk.main()

Alistair Buxton (a-j-buxton) wrote :

otoh, indicator-china-weather and classicmenu-indicator both use python-appindicator and both show the warning about child-added, but they both show their menus Ok...

Alistair Buxton (a-j-buxton) wrote :

Please ignore previous example code. It looks like what is happening is that glipper and blueman are trying to add menu entries after sending the menu to the indicator, which doesn't work any more in Saucy. The following code will display both menu items in 12.04 but in Saucy only "One" is displayed:

#!/usr/bin/env python

import gtk
import appindicator

m = gtk.Menu()
i = gtk.MenuItem('One')
i.show()
m.append(i)

a = appindicator.Indicator('test', '/usr/share/icons/ubuntu-mono-light/stock/22/avatar-default.svg', appindicator.CATEGORY_APPLICATION_STATUS)
a.set_status(appindicator.STATUS_ACTIVE)
a.set_menu(m)

j = gtk.MenuItem('Two')
j.show()
m.append(j)

gtk.main()

Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in libappindicator (Ubuntu):
status: New → Confirmed

Has anyone found any sort of workaround for this bug to get indicators working until there's a fix?

I've been using "xfce4-panel". You can have it float, or dock it to the side of the screen. It also does other stuff (task switcher, etc), but I just removed all that and put the indicator area widget on it.

As long as you start it after Unity it works fine. (The last one to start takes control of the notification area.)

Daniel Hahler (blueyed) wrote :

JFI: for Glipper, GlipIt is a good alternative.

Changed in libappindicator (Ubuntu):
status: Confirmed → Triaged
Changed in glipper (Ubuntu):
status: Confirmed → Triaged
Changed in libappindicator (Ubuntu):
importance: Undecided → High
Changed in glipper (Ubuntu):
importance: Undecided → High
summary: - appindicator doesn't work in Saucy
+ appindicator ignores menu entries after having sent the menu to the
+ indicator
Rainer Suhm (rsuhm) wrote :

The blueman-applet didn't work for me as explained above. I 'autoremoved' the python-appindicator, which didn't affect any other of my installed packages. Then the blueman-applet worked, but the exit button in the applet menu was still missing.
I went further and autoremoved python-gconf, which was removing python-gnome2-doc too, but no other packages. Now everything ist fine for me.
If there are other users who have python-appindicator and python-gconf installed, but no other applications depending on them, this might be a temporary solution until the real problem is solved.

Roman (kutashenko) wrote :

I've get this bug with own gtk application after upgrade to 13.10.

This API change/bug seems to affect all indicators that change their menus after creating and showing them for the first time.

The feedindicator (https://code.google.com/p/feedindicator/) is also made unusable by this issue.

I think it's a problem in python-appindicator or even in glib.

Balint Deak (dbalint) wrote :

Nagstamon (http://nagstamon.ifw-dresden.de/) is also affected. Workaround for me is to use it in hovering mode.

For application developers, I think a work-around to this problem might be simply to call indicator.set_menu(menu) again after any call to menu.append(item). Although it shouldn't be necessary, it works fine with earlier versions of python-appindicator. Calling set_menu(menu) with the same menu that is already registered seems to be OK.

Alistair Buxton (a-j-buxton) wrote :

Calling set_menu() again does not work.

The message about "child-added" actually comes from libdbusmenu - none of the other involved packages contain this string at all.

Alistair Buxton (a-j-buxton) wrote :

I just noticed that libdbusmenu produces the following warning while building:

l /usr/bin/vapigen --library=Dbusmenu-0.4 Dbusmenu-0.4.gir
Dbusmenu-0.4.gir:877.7-877.29: warning: Signal `Dbusmenu.Menuitem.child_added' conflicts with method of the same name
      <virtual-method name="child_added">
      ^^^^^^^^^^^^^^^^^^^^^^^
Dbusmenu-0.4.gir:890.7-890.29: warning: Signal `Dbusmenu.Menuitem.child_moved' conflicts with method of the same name
      <virtual-method name="child_moved">
      ^^^^^^^^^^^^^^^^^^^^^^^
Dbusmenu-0.4.gir:906.7-906.33: warning: Signal `Dbusmenu.Menuitem.child_removed' conflicts with method of the same name
      <virtual-method name="child_removed">
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^
Dbusmenu-0.4.gir:973.7-973.31: warning: Virtual method `Dbusmenu.Menuitem.show_to_user' conflicts with method of the same name
      <virtual-method name="show_to_user">
      ^^^^^^^^^^^^^^^^^^^^^^^^^
Dbusmenu-0.4.gir:973.7-973.31: warning: Signal `Dbusmenu.Menuitem.show_to_user' conflicts with method of the same name
      <virtual-method name="show_to_user">
      ^^^^^^^^^^^^^^^^^^^^^^^^^
Generation succeeded - 5 warning(s)

However, I think this is a red herring because removing menu items works as expected - which means the "child-removed" signal which is also mentioned in the warning is working Ok.

Alistair Buxton (a-j-buxton) wrote :

I have tried downgrading all the libappindicator and libdbusmenu packages down to the raring versions and the bug is still present, which means it must be a problem with gtk/glib.

Theredbaron (theredbaron1834) wrote :

I don't know if this helps, but if you install blueman from the debian tree it works just fine, just the ubuntu tree one that messes.

Alistair Buxton (a-j-buxton) wrote :

Some progress:

In libdbusmenu/libdbusmenu-gtk/parser.c the following change was made:

http://bazaar.launchpad.net/~dbusmenu-team/libdbusmenu/trunk.14.04/revision/355

        g_signal_connect (G_OBJECT (menu),
- "child-added",
- G_CALLBACK (child_added_cb),
+#ifdef HAVE_GTK3
+ "insert",
+#else
+ "child-added"
+#endif
+ G_CALLBACK (item_inserted_cb),
                          mi);
        g_signal_connect (G_OBJECT (menu),
- "child-removed",
- G_CALLBACK (child_removed_cb),
+ "remove",
+ G_CALLBACK (item_removed_cb),
                          mi);

Notice in particular that "child-added" has a check which produces a different result depending on gtk2/gtk3, but "child-removed" was simple replaced by "remove".

If I change "child-added" to "something-else", the error message produced changes:

./test-indicator.py:15: Warning: /build/buildd/glib2.0-2.38.1/./gobject/gsignal.c:2475: signal 'something-else' is invalid for instance '0x23b70c0' of type 'GtkMenu'

However, if I change "child-added" to "insert" (so that it matches the GTK3 version, as with the "remove" signal) then the test case segfaults.

Alistair Buxton (a-j-buxton) wrote :

Ok, got it working.

It turns out that there are some more GTK3 tests in the same file which modify the argument list for the item_inserted_cb. It is necessary to remove all the tests so that only the GTK3 versions are present regardless of whether we are actually using GTK3 or not. Failure to do this caused the callback to be called with the wrong args, causing the segfault.

What I still don't understand:

* Why "insert" was special cased, but "remove" was not.
* How did this code ever work before.
* What changed to make it stop working.

Alistair Buxton (a-j-buxton) wrote :

PPA available shortly: https://launchpad.net/~a-j-buxton/+archive/dbusmenu

Use at your own risk. I DO NOT understand why this works :(

Alistair Buxton (a-j-buxton) wrote :

This is the commit where the "insert" signal was backported from GTK3 to GTK2:

https://git.gnome.org/browse/gtk+/commit/?h=gtk-2-24&id=5ada51d3c7d3b476d954c4fdddb4895c3de00220

This explains why the fix works. However, it still doesn't explain what happened to "child-added".

Sebastien Bacher (seb128) wrote :

Hey Lars, could you have a look to this issue? I think you had a look at those GTK patches in saucy... did we drop some as not-needed?

Changed in libappindicator (Ubuntu):
assignee: nobody → Lars Uebernickel (larsu)
Alistair Buxton (a-j-buxton) wrote :

@seb128: thanks for that clue: you are right, and this fills in all the pieces.

In raring the "child-added" signal is added by the Ubuntu specific patch 072_indicator_menu_update.patch
In saucy this patch is gone because upstream added the equivalent "insert" signal, but libdbusmenu was not updated to match the new signal name.

Sebastien Bacher (seb128) wrote :

Thank for the work. Did the new signal got backported to the old gtk? Or should we patch gtk as well?

Alistair Buxton (a-j-buxton) wrote :

Yes, the new signal was backported and it is in saucy already- that is why my fix worked. What I missed is that "child-added" was an Ubuntu-specific thing, which is why I could never find it in the source - it's simply gone in saucy. See the merge proposal I just submitted for the tl;dr summary of all this.

PS Jenkins bot (ps-jenkins) wrote :

Fix committed into lp:libdbusmenu at revision 462, scheduled for release in libdbusmenu, milestone Unknown

Changed in libdbusmenu:
status: New → Fix Committed
PS Jenkins bot (ps-jenkins) wrote :

Fix committed into lp:libdbusmenu/13.10 at revision 462, scheduled for release in libdbusmenu, milestone Unknown

description: updated
Changed in libdbusmenu (Ubuntu):
status: New → Fix Committed
importance: Undecided → High
Changed in libappindicator (Ubuntu):
assignee: Lars Uebernickel (larsu) → nobody
no longer affects: libappindicator (Ubuntu)
Changed in libdbusmenu (Ubuntu Saucy):
status: New → In Progress
importance: Undecided → High
no longer affects: glipper (Ubuntu)
no longer affects: blueman (Ubuntu)
no longer affects: blueman (Ubuntu Saucy)
Changed in glipper:
status: New → Invalid
no longer affects: glipper (Ubuntu Saucy)

Hello Jeremy, or anyone else affected,

Accepted into saucy-proposed. The package will build now and be available in a few hours in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in libdbusmenu (Ubuntu Saucy):
status: In Progress → Fix Committed
tags: added: verification-needed
theAntiBob (torinkindred) wrote :

Commit Log for Tue Nov 12 18:26:58 2013

Upgraded the following packages:
gir1.2-dbusmenu-glib-0.4 (12.10.3+13.10.20130913-0ubuntu2) to 12.10.3+13.10.20131104-0ubuntu1
gir1.2-dbusmenu-gtk-0.4 (12.10.3+13.10.20130913-0ubuntu2) to 12.10.3+13.10.20131104-0ubuntu1
libdbusmenu-glib4 (12.10.3+13.10.20130913-0ubuntu2) to 12.10.3+13.10.20131104-0ubuntu1
libdbusmenu-gtk3-4 (12.10.3+13.10.20130913-0ubuntu2) to 12.10.3+13.10.20131104-0ubuntu1
libdbusmenu-gtk4 (12.10.3+13.10.20130913-0ubuntu2) to 12.10.3+13.10.20131104-0ubuntu1

My issue was resolved by this proposed package.
Thank you!

Miklos Juhasz (mjuhasz) on 2013-11-13
tags: added: verification-done
removed: verification-needed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package libdbusmenu - 12.10.3+13.10.20131104-0ubuntu1

---------------
libdbusmenu (12.10.3+13.10.20131104-0ubuntu1) saucy; urgency=low

  [ Robert Bruce Park ]
  * Use "insert" signal instead of "child-added". (LP: #1203888)

  [ Alistair Buxton ]
  * Use "insert" signal instead of "child-added". (LP: #1203888)

  [ Ubuntu daily release ]
  * Automatic snapshot from revision 462
 -- Ubuntu daily release <email address hidden> Mon, 04 Nov 2013 16:46:50 +0000

Changed in libdbusmenu (Ubuntu Saucy):
status: Fix Committed → Fix Released

The verification of the Stable Release Update for libdbusmenu has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regresssions.

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package libdbusmenu - 12.10.3+14.04.20131125-0ubuntu1

---------------
libdbusmenu (12.10.3+14.04.20131125-0ubuntu1) trusty; urgency=low

  [ Alistair Buxton ]
  * Use "insert" signal instead of "child-added" (LP: #1203888) In
    recent Gtk+2 versions, the "insert" signal has been backported from
    Gtk+3. This replaces the "child-added" signal, which was carried in
    an Ubuntu-specific patch and was dropped in Saucy. . (LP: #1203888)

  [ Ubuntu daily release ]
  * Automatic snapshot from revision 462
 -- Ubuntu daily release <email address hidden> Mon, 25 Nov 2013 03:55:53 +0000

Changed in libdbusmenu (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers