core: remove renderer widgets in ~CSessionLockSurface instead of in onGlobalRemoved

This commit is contained in:
Maximilian Seidler 2024-06-27 21:00:01 +02:00
parent d2324c25bd
commit 405aa42de8
2 changed files with 3 additions and 5 deletions

View File

@ -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);

View File

@ -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