From a3fda12ba15286ee412c83a7137fc6cb14afa266 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Thu, 23 Mar 2023 00:39:32 +0000 Subject: [PATCH] window: unassign surface on unmap --- src/Window.cpp | 2 ++ src/helpers/WLSurface.cpp | 4 ++++ src/helpers/WLSurface.hpp | 1 + 3 files changed, 7 insertions(+) diff --git a/src/Window.cpp b/src/Window.cpp index 19fb68c2..840944d4 100644 --- a/src/Window.cpp +++ b/src/Window.cpp @@ -336,6 +336,8 @@ void CWindow::onUnmap() { m_vRealSize.setCallbackOnBegin(nullptr); std::erase_if(g_pCompositor->m_vWindowFocusHistory, [&](const auto& other) { return other == this; }); + + m_pWLSurface.unassign(); } void CWindow::onMap() { diff --git a/src/helpers/WLSurface.cpp b/src/helpers/WLSurface.cpp index 38c31e1a..4bb35135 100644 --- a/src/helpers/WLSurface.cpp +++ b/src/helpers/WLSurface.cpp @@ -11,6 +11,10 @@ void CWLSurface::assign(wlr_surface* pSurface) { init(); } +void CWLSurface::unassign() { + destroy(); +} + CWLSurface::~CWLSurface() { destroy(); } diff --git a/src/helpers/WLSurface.hpp b/src/helpers/WLSurface.hpp index 78c07673..e3325f99 100644 --- a/src/helpers/WLSurface.hpp +++ b/src/helpers/WLSurface.hpp @@ -9,6 +9,7 @@ class CWLSurface { ~CWLSurface(); void assign(wlr_surface* pSurface); + void unassign(); CWLSurface(const CWLSurface&) = delete; CWLSurface(CWLSurface&&) = delete;