After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 757623 - Qt5 apps cause mutter to crash
Qt5 apps cause mutter to crash
Status: RESOLVED DUPLICATE of bug 763431
Product: mutter
Classification: Core
Component: wayland
git master
Other Linux
: Normal major
: ---
Assigned To: mutter-maint
mutter-maint
: 754501 760165 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2015-11-05 08:55 UTC by Dima Ryazanov
Modified: 2016-05-03 02:20 UTC
See Also:
GNOME target: 3.22
GNOME version: ---


Attachments
Patch (3.77 KB, patch)
2015-11-05 08:55 UTC, Dima Ryazanov
rejected Details | Review
wayland: Split out shell surface code from meta-wayland-surface.c (92.54 KB, patch)
2015-12-18 01:36 UTC, Jonas Ådahl
none Details | Review
wayland: Keep wl_shell_surface state during loss of window (13.98 KB, patch)
2015-12-18 01:36 UTC, Jonas Ådahl
none Details | Review
wayland: Let the roles handle their windows being managed (8.27 KB, patch)
2015-12-18 01:37 UTC, Jonas Ådahl
none Details | Review
wayland: Set window type of wl_shell_surface popups to 'dropdown menu' (1.13 KB, patch)
2015-12-18 01:37 UTC, Jonas Ådahl
none Details | Review
wayland: Remove wl_shell_surface parent destroy listener in destructor (1.12 KB, patch)
2015-12-18 01:37 UTC, Jonas Ådahl
none Details | Review

Description Dima Ryazanov 2015-11-05 08:55:47 UTC
Created attachment 314870 [details] [review]
Patch

If you run any Qt5 app (e.g. "textedit" from Qt5 examples), it will cause the GNOME shell to crash.

Clients are allowed to commit a NULL buffer to a wl_shell; that causes the window to get unmapped. After that, any attempt to modify the window will cause a crash.

(This is arguably broken behavior on the client's part. However, treating such requests as errors would break Qt5 apps. Instead, we can just ignore them.)
Comment 1 Jonas Ådahl 2015-11-06 04:06:53 UTC
(In reply to Dima Ryazanov from comment #0)
> Created attachment 314870 [details] [review] [review]
> Patch
> 
> If you run any Qt5 app (e.g. "textedit" from Qt5 examples), it will cause
> the GNOME shell to crash.
> 
> Clients are allowed to commit a NULL buffer to a wl_shell; that causes the
> window to get unmapped. After that, any attempt to modify the window will
> cause a crash.
> 
> (This is arguably broken behavior on the client's part. However, treating
> such requests as errors would break Qt5 apps. Instead, we can just ignore
> them.)

I wouldn't say its broken. wl_shell doesn't define the behaviour when a null-buffer is attached and committed and it has typically been implemented as something similar to hiding. In mutter, attaching+committing a NULL simply means destroy the window, and attaching+committing a non-NULL buffer after that showing it again, though with most of the previous state (such as title, wm class etc) lost.

So, I'm not sure whether we should just NULL check and drop any state flat on the floor, or create a new MetaWindow on demand, assuming the client intended to actually attach a valid buffer to it.

I guess simple NULL check is in line with the broken wl_shell support we have in mutter (since we already loose most state on NULL buffer attach), but IMHO, we should at least try a bit harder to play along with original wl_shell practices.
Comment 2 Dima Ryazanov 2015-12-03 10:09:14 UTC
A simple NULL check seems to be enough for Qt5 apps to work. Also, wl_shell is supposed to eventually get replaced by xdg_shell, right? So maybe fixing it is not worth the effort.
Comment 3 Dima Ryazanov 2015-12-03 10:10:12 UTC
Looks like this bug has already been reported earlier.

*** This bug has been marked as a duplicate of bug 754501 ***
Comment 4 Jonas Ådahl 2015-12-18 01:36:53 UTC
Created attachment 317593 [details] [review]
wayland: Split out shell surface code from meta-wayland-surface.c

Move xdg_shell related functionality to a new meta-wayland-xdg-shell.c
and wl_shell related functionality to a new meta-wayland-wl-shell.c,
and adapt role object tree.

Common functionality related to the surface being drawn as a
MetaSurfaceActor was moved to a MetaWaylandSurfaceRoleActorSurface role.

The subsurface role GObject is made to inherit the actor surface GObject.

Shell surface hooks (configure, ping, close, popup done) were added to
a MetaWaylandSurfaceRoleShellSurface GObject which inherits the
surface actor role GObject.

The shell surface roles (xdg_surface, xdg_popup, wl_shell_surface) are
made to inherit the shell surface GObject and implement the relevant
API.
Comment 5 Jonas Ådahl 2015-12-18 01:36:59 UTC
Created attachment 317594 [details] [review]
wayland: Keep wl_shell_surface state during loss of window

It has been common practice (in QT5 for example) to set
wl_shell_surface state at situations where mutter will have destroyed
the MetaWindow. This commit keeps track of the relevant state
separately from MetaWindow, and synchronizes when needed.
Comment 6 Jonas Ådahl 2015-12-18 01:37:04 UTC
Created attachment 317595 [details] [review]
wayland: Let the roles handle their windows being managed

Move xdg_shell specific code from generic Wayland code into the xdg
shell code unit by letting the roles handle the corresponding
MetaWindow being managed.
Comment 7 Jonas Ådahl 2015-12-18 01:37:10 UTC
Created attachment 317596 [details] [review]
wayland: Set window type of wl_shell_surface popups to 'dropdown menu'

The wl_shell_surface popups are mostly used in the same way as
xdg_popup, so set the same window type.
Comment 8 Jonas Ådahl 2015-12-18 01:37:14 UTC
Created attachment 317597 [details] [review]
wayland: Remove wl_shell_surface parent destroy listener in destructor

If the surface is destroyed before the popup is dismissed, the destroy
listener needs to be removed from the parent destroy signal.
Comment 9 Jonas Ådahl 2015-12-22 00:23:18 UTC
*** Bug 754501 has been marked as a duplicate of this bug. ***
Comment 10 Rui Matos 2016-01-05 17:40:13 UTC
*** Bug 760165 has been marked as a duplicate of this bug. ***
Comment 11 Jonas Ådahl 2016-03-10 04:24:03 UTC
The patches for making non-trivial wl_shell clients (i.e. QT5) work at least somewhat well are now part of bug 763431. Please consider the patches for that attached to this bug obsolete.
Comment 12 Matthias Clasen 2016-04-19 18:10:11 UTC
would be great to get these reviewed and landed
Comment 13 Rui Matos 2016-04-19 19:11:25 UTC
I thought Jonas wanted to go with the patch set in bug 763431 instead? Should we close this bug ?
Comment 14 Jonas Ådahl 2016-04-20 01:39:34 UTC
(In reply to Rui Matos from comment #13)
> I thought Jonas wanted to go with the patch set in bug 763431 instead?
> Should we close this bug ?

Yep, lets close this one.

*** This bug has been marked as a duplicate of bug 763431 ***