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;