From 5dee5c325e45bbda9da656290b6478de55a09f90 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 28 Apr 2019 22:03:18 +0200 Subject: [PATCH] GEventLoop: Don't call process_unprocessed_messages() from itself. This could be tail-call-optimized but it's not, so we end up overflowing the stack space if we recurse too many times. This was causing crashes when resizing Minesweeper. --- LibGUI/GEventLoop.cpp | 3 --- LibGUI/GEventLoop.h | 3 ++- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/LibGUI/GEventLoop.cpp b/LibGUI/GEventLoop.cpp index bbf85e3475..cc97d9323a 100644 --- a/LibGUI/GEventLoop.cpp +++ b/LibGUI/GEventLoop.cpp @@ -316,9 +316,6 @@ void GEventLoop::process_unprocessed_bundles() if (coalesced_resizes) dbgprintf("Coalesced %d resizes\n", coalesced_resizes); #endif - - if (!m_unprocessed_bundles.is_empty()) - process_unprocessed_bundles(); } bool GEventLoop::drain_messages_from_server() diff --git a/LibGUI/GEventLoop.h b/LibGUI/GEventLoop.h index 694dfa62e9..a88194a4ed 100644 --- a/LibGUI/GEventLoop.h +++ b/LibGUI/GEventLoop.h @@ -43,7 +43,8 @@ private: virtual void do_processing() override { - process_unprocessed_bundles(); + while (!m_unprocessed_bundles.is_empty()) + process_unprocessed_bundles(); } void wait_for_event();