LibThreading+Everywhere: Support returning error from BackgroundAction

This patch allows returning an `Error` from the `on_complete` callback
in `BackgroundAction`.

It also adds a custom callback to manage errors returned during its
execution.
This commit is contained in:
Lucas CHOLLET
2022-12-12 23:34:28 +01:00
committed by Linus Groh
parent 664117564a
commit 2693745336
6 changed files with 38 additions and 21 deletions

View File

@@ -120,10 +120,11 @@ void ThreadStackWidget::refresh()
return Symbolication::symbolicate_thread(pid, tid, Symbolication::IncludeSourcePosition::No);
},
[weak_this = make_weak_ptr()](auto result) {
[weak_this = make_weak_ptr()](auto result) -> ErrorOr<void> {
if (!weak_this)
return;
return {};
Core::EventLoop::current().post_event(const_cast<Core::Object&>(*weak_this), make<CompletionEvent>(move(result)));
return {};
});
}