From a74bbb3a82e23446c79a39b29f12ab2c32ef8015 Mon Sep 17 00:00:00 2001 From: Sebastian Gaida <sebastian-gaida@gmx.de> Date: Tue, 31 Aug 2021 15:42:48 +0200 Subject: [PATCH] [#89] remove resize event handle --- include/vkcv/Window.hpp | 1 + src/vkcv/Window.cpp | 2 +- src/vkcv/WindowManager.cpp | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/vkcv/Window.hpp b/include/vkcv/Window.hpp index d9966377..ac024c3e 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 d2b5e632..7d423043 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 d0f4dc0d..48eab276 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); -- GitLab