mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:27:35 +00:00
LibThreading: Execute on_error
on the original EventLoop
As the user might want to have interactions with LibGUI while handling errors, this code should be executed in the original `EventLoop`. Similarly to what is done with the error-free path.
This commit is contained in:
parent
b084759690
commit
ebb9c3a430
2 changed files with 16 additions and 8 deletions
|
@ -98,8 +98,12 @@ private:
|
|||
error = result.release_error();
|
||||
|
||||
m_promise->cancel(Error::from_errno(ECANCELED));
|
||||
if (m_on_error)
|
||||
m_on_error(move(error));
|
||||
if (m_on_error) {
|
||||
origin_event_loop->deferred_invoke([this, error = move(error)]() mutable {
|
||||
m_on_error(move(error));
|
||||
});
|
||||
origin_event_loop->wake();
|
||||
}
|
||||
|
||||
remove_from_parent();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue