From 405aa42de883a7080d3e02200e91e76484b3a97b Mon Sep 17 00:00:00 2001 From: Maximilian Seidler Date: Thu, 27 Jun 2024 21:00:01 +0200 Subject: [PATCH] core: remove renderer widgets in ~CSessionLockSurface instead of in onGlobalRemoved --- src/core/LockSurface.cpp | 2 ++ src/core/hyprlock.cpp | 6 +----- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/core/LockSurface.cpp b/src/core/LockSurface.cpp index beb522b..95ae232 100644 --- a/src/core/LockSurface.cpp +++ b/src/core/LockSurface.cpp @@ -27,6 +27,8 @@ static const wp_fractional_scale_v1_listener fsListener = { }; CSessionLockSurface::~CSessionLockSurface() { + g_pRenderer->removeWidgetsFor(this); + if (fractional) { wp_viewport_destroy(viewport); wp_fractional_scale_v1_destroy(fractional); diff --git a/src/core/hyprlock.cpp b/src/core/hyprlock.cpp index 05eda53..8ea5059 100644 --- a/src/core/hyprlock.cpp +++ b/src/core/hyprlock.cpp @@ -300,11 +300,7 @@ 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); - 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); - } + std::erase_if(m_vOutputs, [name](const auto& other) { return other->name == name; }); } // end wl_registry