From ad9183340716928dcbb4928f314f0e010170ed0f Mon Sep 17 00:00:00 2001 From: scorpion-26 Date: Fri, 15 Mar 2024 19:29:56 +0100 Subject: [PATCH] Fix infinite loop on Window::Close() Apparently gtk_main_quit doesn't work anymore due to the changes to the main loop --- src/Window.cpp | 5 +++-- src/Window.h | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Window.cpp b/src/Window.cpp index 2f52cf7..db9a459 100644 --- a/src/Window.cpp +++ b/src/Window.cpp @@ -60,8 +60,9 @@ void Window::Init(const std::string& overideConfigLocation) void Window::Run() { Create(); - while (gtk_main_iteration()) + while (!bShouldQuit) { + gtk_main_iteration(); if (bHandleMonitorChanges) { // Flush the event loop @@ -185,7 +186,7 @@ void Window::Destroy() void Window::Close() { Destroy(); - gtk_main_quit(); + bShouldQuit = true; } void Window::UpdateMargin() diff --git a/src/Window.h b/src/Window.h index 0ce5d87..f9bf5e8 100644 --- a/src/Window.h +++ b/src/Window.h @@ -78,5 +78,6 @@ private: GdkMonitor* m_Monitor = nullptr; + bool bShouldQuit = false; bool bHandleMonitorChanges = false; };