浏览代码

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.
Andreas Kling 6 年之前
父节点
当前提交
5dee5c325e
共有 2 个文件被更改,包括 2 次插入4 次删除
  1. 0 3
      LibGUI/GEventLoop.cpp
  2. 2 1
      LibGUI/GEventLoop.h

+ 0 - 3
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()

+ 2 - 1
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();