From bd02178e9642c0b791ecf443014d7b6d05b82b6d Mon Sep 17 00:00:00 2001 From: Vaxry <43317083+vaxerski@users.noreply.github.com> Date: Wed, 31 Dec 2025 18:13:42 +0100 Subject: [PATCH] desktop/LS: avoid creating an invalid LS if no monitor could be found (#12787) --- src/desktop/view/LayerSurface.cpp | 34 +++++++++++++++---------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/desktop/view/LayerSurface.cpp b/src/desktop/view/LayerSurface.cpp index f61d9554..2d863225 100644 --- a/src/desktop/view/LayerSurface.cpp +++ b/src/desktop/view/LayerSurface.cpp @@ -23,24 +23,11 @@ PHLLS CLayerSurface::create(SP resource) { pLS->m_wlSurface->assign(resource->m_surface.lock(), pLS); - if (!pMonitor) { - Log::logger->log(Log::ERR, "New LS has no monitor??"); - return pLS; - } - - if (pMonitor->m_mirrorOf) - pMonitor = g_pCompositor->m_monitors.front(); - - pLS->m_self = pLS; - - pLS->m_namespace = resource->m_layerNamespace; - - pLS->m_layer = resource->m_current.layer; - pLS->m_popupHead = CPopup::create(pLS); - pLS->m_monitor = pMonitor; - pMonitor->m_layerSurfaceLayers[resource->m_current.layer].emplace_back(pLS); - pLS->m_ruleApplicator = makeUnique(pLS); + pLS->m_self = pLS; + pLS->m_namespace = resource->m_layerNamespace; + pLS->m_layer = resource->m_current.layer; + pLS->m_popupHead = CPopup::create(pLS); g_pAnimationManager->createAnimation(0.f, pLS->m_alpha, g_pConfigManager->getAnimationPropertyConfig("fadeLayersIn"), pLS, AVARDAMAGE_ENTIRE); g_pAnimationManager->createAnimation(Vector2D(0, 0), pLS->m_realPosition, g_pConfigManager->getAnimationPropertyConfig("layersIn"), pLS, AVARDAMAGE_ENTIRE); @@ -50,6 +37,19 @@ PHLLS CLayerSurface::create(SP resource) { pLS->m_alpha->setValueAndWarp(0.f); + if (!pMonitor) { + Log::logger->log(Log::DEBUG, "LayerSurface {:x} (namespace {} layer {}) created on NO MONITOR ?!", rc(resource.get()), resource->m_layerNamespace, + sc(pLS->m_layer)); + + return pLS; + } + + if (pMonitor->m_mirrorOf) + pMonitor = g_pCompositor->m_monitors.front(); + + pLS->m_monitor = pMonitor; + pMonitor->m_layerSurfaceLayers[resource->m_current.layer].emplace_back(pLS); + Log::logger->log(Log::DEBUG, "LayerSurface {:x} (namespace {} layer {}) created on monitor {}", rc(resource.get()), resource->m_layerNamespace, sc(pLS->m_layer), pMonitor->m_name);