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.
This commit is contained in:
Andreas Kling 2020-02-24 21:18:35 +01:00
parent 2ad405c789
commit 90c4e6b000
Notes: sideshowbarker 2024-07-19 09:04:47 +09:00

View file

@ -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<Core::DeferredInvocationEvent>([this](auto&) {
Core::EventLoop::current().post_event(*this, make<Core::DeferredInvocationEvent>([this](auto&) {
m_on_complete(m_result.release_value());
this->unref();
}));
Core::EventLoop::main().wake();
Core::EventLoop::wake();
} else
this->unref();
});