scene: Fix attempting to scanout empty surfaces

X11 windows might be mapped but temporarily have missing wl_surface or
the wl_surface can be temporarily unmapped.

CCBUG: 491964
This commit is contained in:
Vlad Zahorodnii 2024-08-28 13:43:29 +03:00
parent 5b2304c709
commit 8443da3083

View file

@ -208,11 +208,14 @@ QList<SurfaceItem *> WorkspaceScene::scanoutCandidates(ssize_t maxCount) const
if (!window->isClient() || window->opacity() != 1.0 || !window->isFullScreen() || window->windowItem()->hasEffects()) {
return {};
}
if (!windowItem->surfaceItem()) {
SurfaceItem *surfaceItem = window->surfaceItem();
if (!surfaceItem || !surfaceItem->isVisible()) {
continue;
}
QRegion occlusion;
if (!addCandidates(windowItem->surfaceItem(), ret, maxCount, occlusion)) {
if (!addCandidates(surfaceItem, ret, maxCount, occlusion)) {
return {};
}
return ret;