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;