From 35a854e991eaf81ec074ddadb52ddf8bbcd4ccf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Tue, 26 May 2015 09:26:19 +0200 Subject: [PATCH] [server] Only send surface leave if resources are still valid If a resource is null, because e.g. the surface got already destroyed, wayland will create an error while marshalling arguments causing the connected client to in worst case abort. --- src/wayland/keyboard_interface.cpp | 4 +++- src/wayland/pointer_interface.cpp | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/wayland/keyboard_interface.cpp b/src/wayland/keyboard_interface.cpp index bfd1c6bc27..6f7a130e7f 100644 --- a/src/wayland/keyboard_interface.cpp +++ b/src/wayland/keyboard_interface.cpp @@ -118,7 +118,9 @@ void KeyboardInterface::setFocusedSurface(SurfaceInterface *surface, quint32 ser { Q_D(); if (d->focusedSurface) { - wl_keyboard_send_leave(d->resource, serial, d->focusedSurface->resource()); + if (d->resource && d->focusedSurface->resource()) { + wl_keyboard_send_leave(d->resource, serial, d->focusedSurface->resource()); + } disconnect(d->destroyConnection); } d->focusedSurface = surface; diff --git a/src/wayland/pointer_interface.cpp b/src/wayland/pointer_interface.cpp index 78440db663..28e73f89ca 100644 --- a/src/wayland/pointer_interface.cpp +++ b/src/wayland/pointer_interface.cpp @@ -116,7 +116,9 @@ void PointerInterface::setFocusedSurface(SurfaceInterface *surface, quint32 seri Q_D(); Q_ASSERT(d->resource); if (d->focusedSurface) { - wl_pointer_send_leave(d->resource, serial, d->focusedSurface->resource()); + if (d->resource && d->focusedSurface->resource()) { + wl_pointer_send_leave(d->resource, serial, d->focusedSurface->resource()); + } disconnect(d->destroyConnection); } if (!surface) {