Drop appmenu-qt5 from default installations

Bug #1612767 reported by Dmitry Shachnev on 2016-08-12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
indicator-appmenu (Ubuntu)
qtbase-opensource-src (Ubuntu)

Bug Description

Currently we are using appmenu-qt5 as our platform theme on desktop, however it has many disadvantages, which make me want to get rid of it:

1) Its design is a hack: instead of the using normal QPA API for getting the menu, it retrieves the menu bar using QWidget::findChild, and then casts the pointer to QMenu*. The normal methods (which are getting called by Qt) remain empty stubs.

2) It is preventing applications from using GTK+ theme integration, such as dialogs (I reported this as bug 1378935, but there is no easy way to fix that).

3) It is not working with Qt Quick applications (because it expects a QtWidgets window; see also bug 1323853). The standard implementation will work with i.e. Qt Quick Controls 2 using apps (implemented in https://codereview.qt-project.org/142733).

4) It breaks other environments such as Plasma or GNOME when installed: see bug 1434516, bug 1307619.

5) Finally, it is mostly unmaintained: most patches since 2014 are authored by me, however I see no point continuing to develop that code.

Recently, Shawn Rutledge and I have written a native implementation of what appmenu-qt5 provides (global menu and system tray), which is part of Qt. That code uses the normal API, is well maintained, and works better than appmenu-qt5 (or at least not worse).

So I propose to drop appmenu-qt5 from default Ubuntu installations, and maybe later from archive too.

Unfortunately we use Qt 5.6, and some of the needed patches are only in Qt 5.7, so I would like to backport them to our packaging:

https://code.qt.io/cgit/qt/qtbase.git/commit/?id=f199bb9133fe0446 (will be in 5.6.2 / 5.7.0)
https://code.qt.io/cgit/qt/qtbase.git/commit/?id=488cf78e44947eff (will be in 5.7.0)
https://code.qt.io/cgit/qt/qtbase.git/commit/?id=b6a824d0a3b4fabd (will be in 5.7.0)
https://code.qt.io/cgit/qt/qtbase.git/commit/?id=e4d79e1fdeb6b26b (will be in 5.7.0)

Timo: if you have no objections, I will commit those patches to the packaging Git.

After we do that, I will remove the appmenu-qt5 recommendation from indicator-appmenu (that is the only package referring to it).

Related branches

description: updated
Timo Jyrinki (timo-jyrinki) wrote :

Thanks a lot for that work! No objections, commit away but don't upload yet since we still struggle with the proposed migration...

Dmitry Shachnev (mitya57) wrote :

Thanks Timo! I committed the changes last week.

Unfortunately I get tests failures when trying to build qtbase, but they seem unrelated to my changes (https://launchpad.net/~mitya57/+archive/ubuntu/test2/+build/10643352, I get the same locally). Do you know anything about this?

description: updated
Timo Jyrinki (timo-jyrinki) wrote :

Those don't look familiar, I wonder if they are related to new libc6 or something. I had a successful build on Augusty 9th.

I'll try a new build myself.

Timo Jyrinki (timo-jyrinki) wrote :

Ok I've the same problem:


It seems it's something new in the last two weeks in yakkety, and not related to Qt changes. Maybe glibc 2.24 related?

Timo Jyrinki (timo-jyrinki) wrote :

Dmitry, any idea how did you get it reproduced locally? I'm getting:

$ QT_QPA_PLATFORM=xcb xvfb-run -a -s "-screen 0 640x480x24" make check QT_PLUGIN_PATH=~/b/qtbase-opensource-src-5.6.1+dfsg/plugins LD_LIBRARY_PATH=~/b/qtbase-opensource-src-5.6.1+dfsg/lib PATH=~/b/qtbase-opensource-src-5.6.1+dfsg/bin:$PATH -k
/home/ubuntu/b/qtbase-opensource-src-5.6.1+dfsg/tests/auto/printsupport/dialogs/qabstractprintdialog/target_wrapper.sh ./tst_qabstractprintdialog
make: 'tst_qabstractprintdialog' is up to date.
********* Start testing of tst_QAbstractPrintDialog *********
Config: Using QtTest library 5.6.1, Qt 5.6.1 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 6.2.0 20160822)
PASS : tst_QAbstractPrintDialog::initTestCase()
PASS : tst_QAbstractPrintDialog::getSetCheck()
XFAIL : tst_QAbstractPrintDialog::setMinMax() QTBUG-22637
   Loc: [tst_qabstractprintdialog.cpp(107)]
PASS : tst_QAbstractPrintDialog::setMinMax()
PASS : tst_QAbstractPrintDialog::setFromTo()
PASS : tst_QAbstractPrintDialog::cleanupTestCase()
Totals: 5 passed, 0 failed, 0 skipped, 0 blacklisted
********* Finished testing of tst_QAbstractPrintDialog *********

Dmitry Shachnev (mitya57) wrote :

By "locally" I meant a pbuilder on my own server, not really locally...

Timo Jyrinki (timo-jyrinki) wrote :

I used a clean pbuilder too by manually logging in inside and apt build-dep:ing and building, and couldn't reproduce it. I'm not sure what could explain the difference.

I have now a successful build with those tests disabled, but it would be useful to file a bug against the package change that causes this regression, if only it would be known. Meanwhile, the previous qtbase landing hasn't migrated to release pocket still so this is pending.

Dmitry Shachnev (mitya57) wrote :

I have just been able to reproduce the tst_QStaticText failure in my pbuilder (on amd64).

I gathered the debug images from that test and submitted upstream as https://bugreports.qt.io/browse/QTBUG-55653 (see attached file there).

The tst_QAbstractPrintDialog test crashes for me with SIGPIPE in libcups httpFlushWrite function. Will investigate that a bit later.

Note that I retried the builds in my PPA today, so there are new build logs there which may be different from the previous ones.

Dmitry Shachnev (mitya57) wrote :

Here is the stacktrace of the tst_QAbstractPrintDialog crash.

For me it happens only when libqt5printsupport5 is installed (and picked by the testsuite), when I remove that package the test passes (hello, the docs building hack).

Timo Jyrinki (timo-jyrinki) wrote :

Interestingly, tst_QStaticText passed just fine in my landing PPA build for all i386 armhf amd64 running tests: https://launchpad.net/~ci-train-ppa-service/+archive/ubuntu/landing-034/+sourcepub/6845112/+listing-archive-extra

Dmitry Shachnev (mitya57) wrote :

The difference between my PPA and yours is that mine didn't have -proposed archive enabled. I have now enabled -proposed and retried one of the builds, to see if it makes any difference.

Timo Jyrinki (timo-jyrinki) wrote :

No change in your PPA it seems.

Meanwhile, silo 34 would have the build that does pass those tests and skips the printer related tests.

However, as reported on IRC, transmission-qt crashes on yakkety on startup when using the silo, if not removing appmenu-qt5. Here's the backtrace:
Thread 1 "transmission-qt" received signal SIGSEGV, Segmentation fault.
0x00007ffff590b518 in vtable for __cxxabiv1::__si_class_type_info ()
   from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
(gdb) bt
#0 0x00007ffff590b518 in vtable for __cxxabiv1::__si_class_type_info ()
   from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#1 0x00007ffff6907c5e in copyActionToPlatformItem (action=action@entry=0x555555bb9430,
    item=item@entry=0x555555b6c690, itemsMenu=0x555555b72840) at widgets/qmenu.cpp:3228
#2 0x00007ffff6907861 in QMenuPrivate::syncPlatformMenu (this=0x555555c2abd0)
    at widgets/qmenu.cpp:202
#3 0x00007ffff6907977 in QMenu::setPlatformMenu (this=this@entry=0x555555c28680,
    platformMenu=<optimized out>) at widgets/qmenu.cpp:3425
#4 0x00007ffff6af69f5 in QSystemTrayIconPrivate::addPlatformMenu (this=0x555555bc7020,
    menu=0x555555c28680) at util/qsystemtrayicon.cpp:761
#5 0x00007ffff6af6ad2 in QSystemTrayIconPrivate::updateMenu_sys_qpa (
    this=0x555555bc7020) at util/qsystemtrayicon.cpp:710
#6 0x00005555555d5b62 in ?? ()
#7 0x000055555559afdf in ?? ()
#8 0x0000555555595e9d in ?? ()
#9 0x00007ffff4fd33f1 in __libc_start_main (main=0x555555595e60, argc=1,
    argv=0x7fffffffdea8, init=<optimized out>, fini=<optimized out>,
    rtld_fini=<optimized out>, stack_end=0x7fffffffde98) at ../csu/libc-start.c:291
#10 0x00005555555964e9 in ?? ()

Should appmenu-qt5 forced to be removed from some package instead of allowing it to be continue to be installed?

Dmitry Shachnev (mitya57) wrote :

Sorry that I did not notice that earlier. It looks like we simply need a non-change rebuild of appmenu-qt5 against new Qt.

The ABI break was introduced not in the patch adding global menu support, but in dbusmenu_exclusive_groups.diff which is a bugfix and affects the tray icons too.

Maybe we will need to rebuild frameworkintegration too.

If you think an ABI break is something too intrusive to do at this point of cycle, feel free to drop the dbusmenu_exclusive_groups.diff patch.

Timo Jyrinki (timo-jyrinki) wrote :

Ok the crash goes away indeed with a rebuild, thanks! That should be fine.

Can you elaborate a bit how the global menus would be supposed to be working with these patches when running Qt applications under Unity 7 environment? I can actually see that for whatever reason current yakkety doesn't have those working even without landing-034 PPA, so the appmenu-qt5 seems to have become broken regardless right now.

New bugs should probably be filed for any next actions, whether in Unity itself or elsewhere.

Dmitry Shachnev (mitya57) wrote :

What broke appmenu-qt5 may be https://git.gnome.org/browse/gnome-session/commit/?id=971baf2e225abc5a.

In this case we probably need to backport https://git.gnome.org/browse/gnome-session/commit/?id=ce4208add3b49d44 which fixes that issue.

However this should not affect the configuration without appmenu-qt5. Hopefully more on this soon.

description: updated
Dmitry Shachnev (mitya57) wrote :

What broke both configurations, with and without appmenu-qt5, was http://code.qt.io/cgit/qt/qtbase.git/commit/?id=717ff946391233e7.

I have pushed a quick fix to our packaging Git. It cannot be forwarded as is, but I will try to discuss this with upstream and make sure it is fixed upstream too.

Timo Jyrinki (timo-jyrinki) wrote :

Thank you! I've pushed a new build to silo 034. I also realize my Qt 5.6 testing involved Unity 8 on phone and desktop, and smoketesting Plasma, LXQt etc but not really checking the appmenu functionality.

Dmitry Shachnev (mitya57) wrote :

With the latest packages in 034 both menus and tray icons seem to work fine.

For some reason the shortcuts are not shown in menus, but according to dbus-monitor log, Qt is behaving correctly here (shortcuts are exported), so this seems a regression somewhere on server side (the same happens with appmenu-qt5).

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package qtbase-opensource-src - 5.6.1+dfsg-3ubuntu3~3

qtbase-opensource-src (5.6.1+dfsg-3ubuntu3~3) yakkety; urgency=medium

  [ Timo Jyrinki ]
  * debian/patches/QDBusServer-delay-processing-of-D-Bus-messages.patch:
    - Fix DBus message processing (LP: #1608822)
  * debian/patches/xcb-Send-also-text-plain-when-a-text-uri-list-is-dro.patch:
    - Fix drag and drop from Qt to skype (LP: #1586857)
  * debian/patches/qt5-qmake-arm-linux-gnueabihf:
    - Support cross-compilation inside chroot using pkg-config (LP: #1580981)
  * debian/patches/Make-sure-connection-is-not-null-before-using-it.patch:
    - Fix unity8 crasher (LP: #1612309)
  * Update symbols with pkgkde-mark-qt5-private-symbols.
  * Disable printsupport tests that started failing but only on builders,
    possibly with new glibc. See LP: #1612767 for details.

  [ Dmitry Shachnev ]
  * Backport some upstream patches to add support for D-Bus global menus,
    and improve support for D-Bus tray icons (LP: #1612767):
    + dbustray_use_separate_connections.diff (fix for multiple tray icons)
    + dbusmenu_exclusive_groups.diff (fix for radio actions)
    + qplatformmenubar_createmenu.diff (adding a method to QPlatformMenuBar)
    + dbusmenu_global_menu.diff (add support for D-Bus global menus)
  * Add a distro patch to stop setting AA_DontUseNativeMenuBar unconditionally
    (allow_native_menubar.diff): we want this attribute to be false by default,
    but applications should be able to override it.

 -- Timo Jyrinki <email address hidden> Sat, 03 Sep 2016 13:58:20 +0000

Changed in qtbase-opensource-src (Ubuntu):
status: New → Fix Released
Timo Jyrinki (timo-jyrinki) wrote :

Yes the global menus seemed to be working fine both with and without appmenu-qt5 now.

Launchpad Janitor (janitor) wrote :

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

Changed in indicator-appmenu (Ubuntu):
status: New → Confirmed
Dmitry Shachnev (mitya57) wrote :

> For some reason the shortcuts are not shown in menus

Thanks a lot to Albert Astals Cid who found the issue and fixed it!

We are now almost ready to getting this bug closed.

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package indicator-appmenu - 15.02.0+16.10.20160927-0ubuntu1

indicator-appmenu (15.02.0+16.10.20160927-0ubuntu1) yakkety; urgency=medium

  * Drop appmenu-qt5 recommendation. (LP: #1612767)

 -- Dmitry Shachnev <email address hidden> Tue, 27 Sep 2016 12:50:20 +0000

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

Other bug subscribers

Bug attachments