diff --git a/src/core/shellhandler.cpp b/src/core/shellhandler.cpp index 72521e125..2d19c5e14 100644 --- a/src/core/shellhandler.cpp +++ b/src/core/shellhandler.cpp @@ -779,6 +779,10 @@ void ShellHandler::registerSurfaceToForeignToplevel(SurfaceWrapper *wrapper) m_treelandForeignToplevel->addSurface(wrapper); } }); + + connect(wrapper, &SurfaceWrapper::aboutToBeInvalidated, this, [this, wrapper] { + m_treelandForeignToplevel->removeSurface(wrapper); + }); } void ShellHandler::setupDockPreview() diff --git a/src/modules/input-manager/inputmanagerinterfacev1.cpp b/src/modules/input-manager/inputmanagerinterfacev1.cpp index 3a227dfae..5b7297246 100644 --- a/src/modules/input-manager/inputmanagerinterfacev1.cpp +++ b/src/modules/input-manager/inputmanagerinterfacev1.cpp @@ -54,6 +54,9 @@ void TreelandInputManagerInterfaceV1Private::bind_resource(Resource *resource) { TreelandInputManagerInterfaceV1::DeviceTypes types = q->inputDeviceListTypes(); struct wlr_seat_client *seatClient = Helper::instance()->seat()->handle()->client_for_wl_client(resource->client()); + if (!seatClient) + return; + struct wl_resource *clientResource; wl_resource_for_each(clientResource, &seatClient->resources) { send_capability_available(resource->handle, types.toInt(), clientResource); @@ -173,6 +176,9 @@ void TreelandInputManagerInterfaceV1::sendCapabilityAvailable(TreelandInputManag for (const auto &resource : d->resourceMap()) { struct wlr_seat_client *seatClient = Helper::instance()->seat()->handle()->client_for_wl_client(resource->client()); + if (!seatClient) + continue; + struct wl_resource *clientResource; wl_resource_for_each(clientResource, &seatClient->resources) { d->send_capability_available(resource->handle, types.toInt(), clientResource); @@ -185,6 +191,9 @@ void TreelandInputManagerInterfaceV1::sendCapabilityUnavailable(TreelandInputMan for (const auto &resource : d->resourceMap()) { struct wlr_seat_client *seatClient = Helper::instance()->seat()->handle()->client_for_wl_client(resource->client()); + if (!seatClient) + continue; + struct wl_resource *clientResource; wl_resource_for_each(clientResource, &seatClient->resources) { d->send_capability_unavailable(resource->handle, types.toInt(), clientResource); @@ -267,6 +276,9 @@ void TreelandInputManagerInterfaceV1::onInputAdded(WInputDevice *input) for (const auto &resource : d->resourceMap()) { struct wlr_seat_client *seatClient = Helper::instance()->seat()->handle()->client_for_wl_client(resource->client()); + if (!seatClient) + continue; + struct wl_resource *clientResource; wl_resource_for_each(clientResource, &seatClient->resources) { d->send_capability_available(resource->handle, type.toInt(), clientResource); @@ -292,6 +304,9 @@ void TreelandInputManagerInterfaceV1::onInputRemoved(WInputDevice *input) for (const auto &resource : d->resourceMap()) { struct wlr_seat_client *seatClient = Helper::instance()->seat()->handle()->client_for_wl_client(resource->client()); + if (!seatClient) + continue; + struct wl_resource *clientResource; wl_resource_for_each(clientResource, &seatClient->resources) { d->send_capability_unavailable(resource->handle, type.toInt(), clientResource);