[PATCH] desktop-shell: fix the crash while clicking TRANSIENT_INACTIVE window
Barry Song
21cnbao at gmail.com
Mon Apr 15 01:52:44 UTC 2019
From: Barry Song <barry.song at navico.com>
It is pretty easy to replicate this bug by involving a Qt Window with
Qt::WindowTransparentForInput flag.
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
QDialog d1(&w, Qt::WindowTransparentForInput);
d1.show();
return a.exec();
}
Click d1 dialog, weston will crash due to NULL==shruf.
Signed-off-by: Barry Song <barry.song at navico.com>
---
desktop-shell/shell.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index 93b1c70b..9473bac1 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -2697,11 +2697,16 @@ desktop_surface_move(struct weston_desktop_surface *desktop_surface,
struct weston_touch *touch = weston_seat_get_touch(seat);
struct shell_surface *shsurf =
weston_desktop_surface_get_user_data(desktop_surface);
- struct weston_surface *surface =
- weston_desktop_surface_get_surface(shsurf->desktop_surface);
- struct wl_resource *resource = surface->resource;
+ struct weston_surface *surface;
+ struct wl_resource *resource;
struct weston_surface *focus;
+ if (!shsurf)
+ return;
+
+ surface = weston_desktop_surface_get_surface(shsurf->desktop_surface);
+ resource = surface->resource;
+
if (pointer &&
pointer->focus &&
pointer->button_count > 0 &&
--
2.17.1
More information about the wayland-devel
mailing list