diff options
| author | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-03-23 22:21:03 +0100 |
|---|---|---|
| committer | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-03-23 22:34:11 +0100 |
| commit | d834a8f7dec2e429c474add833cb9601e3e06c34 (patch) | |
| tree | f32c10a68b5a9a4db7d6c44561b72487cd8fd0ee /src/events/Windows.cpp | |
| parent | bcf7ee6dc225c00b2aea9891ea42aeb18e5b0cc8 (diff) | |
unlink a window properly on destroy
Diffstat (limited to 'src/events/Windows.cpp')
| -rw-r--r-- | src/events/Windows.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/events/Windows.cpp b/src/events/Windows.cpp index f41300fa..338b7f6d 100644 --- a/src/events/Windows.cpp +++ b/src/events/Windows.cpp @@ -90,11 +90,27 @@ void Events::listener_destroyWindow(wl_listener* listener, void* data) { if (g_pXWaylandManager->getWindowSurface(PWINDOW) == g_pCompositor->m_pLastFocus) g_pCompositor->m_pLastFocus = nullptr; - g_pLayoutManager->getCurrentLayout()->onWindowRemoved(PWINDOW); + // TODO: + // We sometimes get invalid pointers here (stack ones) + // this obviously means we tainted wlroots. + // Investigate - g_pCompositor->removeWindowFromVectorSafe(PWINDOW); + g_pLayoutManager->getCurrentLayout()->onWindowRemoved(PWINDOW); Debug::log(LOG, "Window %x destroyed", PWINDOW); + + wl_list_remove(&PWINDOW->listen_mapWindow.link); + wl_list_remove(&PWINDOW->listen_unmapWindow.link); + wl_list_remove(&PWINDOW->listen_destroyWindow.link); + wl_list_remove(&PWINDOW->listen_setTitleWindow.link); + wl_list_remove(&PWINDOW->listen_fullscreenWindow.link); + wl_list_remove(&PWINDOW->listen_commitWindow.link); + if (PWINDOW->m_bIsX11) { + wl_list_remove(&PWINDOW->listen_activateX11.link); + wl_list_remove(&PWINDOW->listen_configureX11.link); + } + + g_pCompositor->removeWindowFromVectorSafe(PWINDOW); } void Events::listener_setTitleWindow(wl_listener* listener, void* data) { |
