renderer: fix safety around sendFrameEventsToWorkspace

ref #5718
This commit is contained in:
Vaxry 2024-04-23 21:15:37 +01:00
parent bb4646bbdf
commit d119513749

View file

@ -1425,7 +1425,7 @@ void CHyprRenderer::renderWorkspace(CMonitor* pMonitor, PHLWORKSPACE pWorkspace,
void CHyprRenderer::sendFrameEventsToWorkspace(CMonitor* pMonitor, PHLWORKSPACE pWorkspace, timespec* now) { void CHyprRenderer::sendFrameEventsToWorkspace(CMonitor* pMonitor, PHLWORKSPACE pWorkspace, timespec* now) {
for (auto& w : g_pCompositor->m_vWindows) { for (auto& w : g_pCompositor->m_vWindows) {
if (w->isHidden() && !w->m_bIsMapped && !w->m_bFadingOut) if (w->isHidden() || !w->m_bIsMapped || w->m_bFadingOut || !w->m_pWLSurface.wlr())
continue; continue;
if (!shouldRenderWindow(w.get(), pMonitor)) if (!shouldRenderWindow(w.get(), pMonitor))
@ -1437,6 +1437,9 @@ void CHyprRenderer::sendFrameEventsToWorkspace(CMonitor* pMonitor, PHLWORKSPACE
for (auto& lsl : pMonitor->m_aLayerSurfaceLayers) { for (auto& lsl : pMonitor->m_aLayerSurfaceLayers) {
for (auto& ls : lsl) { for (auto& ls : lsl) {
if (ls->fadingOut || !ls->surface.wlr())
continue;
wlr_surface_for_each_surface( wlr_surface_for_each_surface(
ls->surface.wlr(), [](wlr_surface* s, int x, int y, void* data) { wlr_surface_send_frame_done(s, (timespec*)data); }, now); ls->surface.wlr(), [](wlr_surface* s, int x, int y, void* data) { wlr_surface_send_frame_done(s, (timespec*)data); }, now);
} }