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) {