Bug 1351224

Summary: [Gtk3] [Wayland] Libreoffice exits with "Error 71 (Protocol error) dispatching to Wayland display." when activating menu while "help tip" is shown
Product: [Fedora] Fedora Reporter: Christian Stadelmann <fedora>
Component: libreofficeAssignee: Caolan McNamara <caolanm>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 24CC: bugzilla.blk, caolanm, dtardon, erack, mstahl, sbergman
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libreoffice-5.1.4.2-4.fc24 libreoffice-5.1.4.2-5.fc24 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-12 15:00:46 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1277927    
Attachments:
Description Flags
Output of $ LC_ALL=C WAYLAND_DEBUG=1 libreoffice none

Description Christian Stadelmann 2016-06-29 13:52:47 UTC
Created attachment 1173928 [details]
Output of $ LC_ALL=C WAYLAND_DEBUG=1 libreoffice

Note: This bug was reported in a comment to bug #1350060 first.

Description of problem:
In some rare cases, libreoffice just exits when showing "View" menu in Impress.

Version-Release number of selected component (if applicable):
libreoffice-5.1.4.2-3.fc24.x86_64
gtk3-3.20.6-1.fc24.x86_64

How reproducible:
I have to try ~10 times to reproduce the crash

Steps to Reproduce:
1. open LibreOffice in a gnome+wayland session (with wayland Gdk backend)
2. open Impress
3. open "View" menu and select any radio button, especially "Slide Sorter"
4. try again until bug happens (may take 10 tries or more)

Actual results:
LibreOffice just exits after printing this warning:

(soffice:10680): Gdk-WARNING **: Error 71 (Protocol error) dispatching to Wayland display. 

Expected results:
No exit.

Additional info:
A backtrace breaking on g_strerror right before LibreOffice exits: https://bugzilla.redhat.com/attachment.cgi?id=1172226 . I've set a breakpoint to g_strerror in https://github.com/GNOME/gtk/blob/master/gdk/wayland/gdkeventsource.c#L197

This issue also happens in other items in this menu (other than "Slide Sorter"), but I can't exactly tell when. Please note that I'm seeing this in firefox (wayland builds) too, see bug #1350060.
I've reported this issue upstream, but they claim it is an LibreOffice bug: 

According to upstream Gtk+ developer Jonas Ã…dahl [1]:

> As far as I can tell what is happening is that:
> 
> 1. a popup is created with the toplevel window as parent
> 2. another popup is created while the previous popup is still mapped, also with the toplevel window as parent
> 
> This is not allowed, as the compositor wouldn't know what to dismiss when the popup grab is broken.
> 
> I'm guessing that either LibreOffice is
> 1) missing to destroy an old menu, or
> 2) using the wrong parent for a child menu, or
> 3) it accidentally creates two popups when it meant to create only one.

[1] https://bugzilla.gnome.org/show_bug.cgi?id=768111#c5 and #c3

Comment 1 Caolan McNamara 2016-06-29 15:14:10 UTC
The old "all the apps are at fault" trick

Comment 2 Caolan McNamara 2016-06-29 15:21:23 UTC
because we're using native gtk3 menubar and menus here perhaps we're dispatching something before the menu is gone or perhaps its a tooltip. Hard to tell at the moment

Comment 3 Caolan McNamara 2016-06-29 16:13:32 UTC
I was able to reproduce this a few times and then not, so its a delicate thing. My guess is that it might be the "sort of tooltips" things.

If in calc I do =SUM in the input bar then I get the same sort of tooltip thing that I'm talking about. Except those ones are persistent, then hit insert in the menubar and I have a guaranteed exit with the same error.

So I'm going to assume the impress problem is the same as the calc problem. Upstream I have already replaced these pseudo-tooltips with native GtkPopOvers and upstream master doesn't crash.

So I'll backpor the tooltips->popovers change to 5-1 as my solution for this

Comment 4 Fedora Update System 2016-06-30 12:47:09 UTC
libreoffice-5.1.4.2-4.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2016-6182a7b901

Comment 5 Fedora Update System 2016-07-02 20:31:03 UTC
libreoffice-5.1.4.2-4.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-6182a7b901

Comment 6 Caolan McNamara 2016-07-04 07:23:13 UTC
*** Bug 1352273 has been marked as a duplicate of this bug. ***

Comment 7 Fedora Update System 2016-07-05 04:56:52 UTC
libreoffice-5.1.4.2-4.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report.

Comment 8 Fedora Update System 2016-07-09 14:38:55 UTC
libreoffice-5.1.4.2-5.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2016-983ce3851d

Comment 9 Fedora Update System 2016-07-10 15:57:17 UTC
libreoffice-5.1.4.2-5.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-983ce3851d

Comment 10 Fedora Update System 2016-07-12 15:00:31 UTC
libreoffice-5.1.4.2-5.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report.