diff --git a/src/core/hyprlock.cpp b/src/core/hyprlock.cpp index 8ea5059..05eda53 100644 --- a/src/core/hyprlock.cpp +++ b/src/core/hyprlock.cpp @@ -300,7 +300,11 @@ void CHyprlock::onGlobal(void* data, struct wl_registry* registry, uint32_t name void CHyprlock::onGlobalRemoved(void* data, struct wl_registry* registry, uint32_t name) { Debug::log(LOG, " | removed iface {}", name); - std::erase_if(m_vOutputs, [name](const auto& other) { return other->name == name; }); + auto outputIt = std::find_if(m_vOutputs.begin(), m_vOutputs.end(), [name](const auto& other) { return other->name == name; }); + if (outputIt != m_vOutputs.end()) { + g_pRenderer->removeWidgetsFor(outputIt->get()->sessionLockSurface.get()); + m_vOutputs.erase(outputIt); + } } // end wl_registry diff --git a/src/renderer/Renderer.cpp b/src/renderer/Renderer.cpp index 08a15c9..394ad26 100644 --- a/src/renderer/Renderer.cpp +++ b/src/renderer/Renderer.cpp @@ -512,3 +512,7 @@ void CRenderer::popFb() { boundFBs.pop_back(); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, boundFBs.empty() ? 0 : boundFBs.back()); } + +void CRenderer::removeWidgetsFor(const CSessionLockSurface* surf) { + widgets.erase(surf); +} diff --git a/src/renderer/Renderer.hpp b/src/renderer/Renderer.hpp index 6599740..d3fc2b6 100644 --- a/src/renderer/Renderer.hpp +++ b/src/renderer/Renderer.hpp @@ -41,6 +41,8 @@ class CRenderer { void pushFb(GLint fb); void popFb(); + void removeWidgetsFor(const CSessionLockSurface* surf); + private: widgetMap_t widgets;