summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-01-25 08:53:46 +0100
committerAndreas Kling <kling@serenityos.org>2022-01-25 09:13:40 +0100
commit58b5aede655adb6626ed1e0b6c89703d4be7ccb7 (patch)
tree141600516cd3d306a2af4180e097724094f7d329 /Userland
parentd1cea5724617203750d3149f68acf2beadb13159 (diff)
downloadserenity-58b5aede655adb6626ed1e0b6c89703d4be7ccb7.zip
CrashReporter: Dispatch backtrace progress callbacks on the main thread
We can't fiddle with GUI widgets off the main thread, so let's use Core::EventLoop::deferred_invoke() to dispatch the work. The progress bar doesn't visibly update yet, but at least we're not crashing anymore.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Applications/CrashReporter/main.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/Userland/Applications/CrashReporter/main.cpp b/Userland/Applications/CrashReporter/main.cpp
index f0fb94e2ef..d3e95292cd 100644
--- a/Userland/Applications/CrashReporter/main.cpp
+++ b/Userland/Applications/CrashReporter/main.cpp
@@ -297,10 +297,13 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
size_t thread_index = 0;
coredump->for_each_thread_info([&](auto& thread_info) {
results.thread_backtraces.append(build_backtrace(*coredump, thread_info, thread_index, [&](size_t frame_index, size_t frame_count) {
- window->set_progress(100.0f * (float)(frame_index + 1) / (float)frame_count);
- progressbar.set_value(frame_index + 1);
- progressbar.set_max(frame_count);
- Core::EventLoop::wake();
+ Core::EventLoop::with_main_locked([&](auto& main) {
+ main->deferred_invoke([&] {
+ window->set_progress(100.0f * (float)(frame_index + 1) / (float)frame_count);
+ progressbar.set_value(frame_index + 1);
+ progressbar.set_max(frame_count);
+ });
+ });
}));
results.thread_cpu_registers.append(build_cpu_registers(thread_info, thread_index));
++thread_index;