Fix certain layersurfaces crashing

This commit is contained in:
vaxerski 2022-05-15 11:25:42 +02:00
parent deb18af955
commit cba4693d39
2 changed files with 18 additions and 1 deletions

View File

@ -58,6 +58,23 @@ void Events::listener_destroyLayerSurface(void* owner, void* data) {
Debug::log(LOG, "LayerSurface %x destroyed", layersurface->layerSurface);
if (!layersurface->fadingOut) {
if (layersurface->layerSurface->mapped) {
Debug::log(LOG, "LayerSurface wasn't unmapped, making a snapshot now!");
// make a snapshot and start fade
// layersurfaces aren't required to unmap before destroy
g_pHyprOpenGL->makeLayerSnapshot(layersurface);
layersurface->alpha = 0.f;
layersurface->fadingOut = true;
} else {
Debug::log(LOG, "Removing LayerSurface that wasn't mapped.");
layersurface->alpha.setValueAndWarp(0.f);
layersurface->fadingOut = true;
}
}
if (layersurface->layerSurface->mapped)
layersurface->layerSurface->mapped = false;

View File

@ -322,7 +322,7 @@ void CHyprRenderer::arrangeLayerArray(SMonitor* pMonitor, const std::list<SLayer
wlr_box full_area = {pMonitor->vecPosition.x, pMonitor->vecPosition.y, pMonitor->vecSize.x, pMonitor->vecSize.y};
for (auto& ls : layerSurfaces) {
if (ls->fadingOut)
if (ls->fadingOut || ls->readyToDelete)
continue;
const auto PLAYER = ls->layerSurface;