Fix infinite loop on Window::Close()

Apparently gtk_main_quit doesn't work anymore due to the changes to the
main loop
This commit is contained in:
scorpion-26 2024-03-15 19:29:56 +01:00
parent 1b16e40598
commit ad91833407
2 changed files with 4 additions and 2 deletions

View file

@ -60,8 +60,9 @@ void Window::Init(const std::string& overideConfigLocation)
void Window::Run() void Window::Run()
{ {
Create(); Create();
while (gtk_main_iteration()) while (!bShouldQuit)
{ {
gtk_main_iteration();
if (bHandleMonitorChanges) if (bHandleMonitorChanges)
{ {
// Flush the event loop // Flush the event loop
@ -185,7 +186,7 @@ void Window::Destroy()
void Window::Close() void Window::Close()
{ {
Destroy(); Destroy();
gtk_main_quit(); bShouldQuit = true;
} }
void Window::UpdateMargin() void Window::UpdateMargin()

View file

@ -78,5 +78,6 @@ private:
GdkMonitor* m_Monitor = nullptr; GdkMonitor* m_Monitor = nullptr;
bool bShouldQuit = false;
bool bHandleMonitorChanges = false; bool bHandleMonitorChanges = false;
}; };