Commit ae018903 authored by Martin Flöser's avatar Martin Flöser
Browse files

[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.
parent 8a25edbf
......@@ -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;
......
......@@ -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) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment