From 90c4e6b000dd9b73e87b343d9b5ca6ff06717e1e Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 24 Feb 2020 21:18:35 +0100 Subject: [PATCH] LibThread: Post the completion callbacks to the *current* event loop FilePicker was not showing thumbnails correctly because once each thumbnail rendering BackgroundAction completed, it posted a deferred invocation event to the *main* event loop. Since FilePicker runs in a nested event loop, those completion callbacks never ran until it was too late and the FilePicker was gone. --- Libraries/LibThread/BackgroundAction.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Libraries/LibThread/BackgroundAction.h b/Libraries/LibThread/BackgroundAction.h index 0637fa71e4..9bc7224956 100644 --- a/Libraries/LibThread/BackgroundAction.h +++ b/Libraries/LibThread/BackgroundAction.h @@ -79,11 +79,11 @@ private: all_actions().resource().enqueue([this] { m_result = m_action(); if (m_on_complete) { - Core::EventLoop::main().post_event(*this, make([this](auto&) { + Core::EventLoop::current().post_event(*this, make([this](auto&) { m_on_complete(m_result.release_value()); this->unref(); })); - Core::EventLoop::main().wake(); + Core::EventLoop::wake(); } else this->unref(); });