diff --git a/include/vkcv/Window.hpp b/include/vkcv/Window.hpp index d996637737b5be76b78b63eef424f85c2a9b4804..ac024c3e2d451372cdec54472ef056e5af015e98 100644 --- a/include/vkcv/Window.hpp +++ b/include/vkcv/Window.hpp @@ -21,6 +21,7 @@ namespace vkcv { GLFWwindow *m_window; SwapchainHandle m_swapchainHandle; bool m_shouldClose; + event_handle<int, int> m_resizeHandle; public: /** diff --git a/src/vkcv/Window.cpp b/src/vkcv/Window.cpp index d2b5e632a10e27805a34785b8976477e3d13f680..7d42304370207cfa145ae2206e4df32b7fc29698 100644 --- a/src/vkcv/Window.cpp +++ b/src/vkcv/Window.cpp @@ -136,7 +136,7 @@ namespace vkcv { Window::e_key.unlock(); Window::e_char.unlock(); Window::e_gamepad.unlock(); - + Window::e_resize.remove(m_resizeHandle); if (m_window) { s_Windows.erase(std::find(s_Windows.begin(), s_Windows.end(), m_window)); glfwDestroyWindow(m_window); diff --git a/src/vkcv/WindowManager.cpp b/src/vkcv/WindowManager.cpp index d0f4dc0df9df77062dfd8dfbb21d02bee3a93adf..48eab2767205e69c695b6021dcbb351032321f47 100644 --- a/src/vkcv/WindowManager.cpp +++ b/src/vkcv/WindowManager.cpp @@ -26,9 +26,10 @@ namespace vkcv { SwapchainHandle swapchainHandle = swapchainManager.createSwapchain(*window); if (resizeable) { - window->e_resize.add([&](int width, int height) { + const event_handle<int, int> &resizeHandle = window->e_resize.add([&](int width, int height) { swapchainManager.signalRecreation(swapchainHandle); }); + window->m_resizeHandle = resizeHandle; } m_windows.push_back(window);