mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-29 06:02:07 +03:00
Kernel: Prevent threads from being destructed between die() and finalize()
Killing remaining threads already happens in Process::die(), but coredumps are only written in Process::finalize(). We need to keep a reference to each of those threads to prevent them from being destructed between those two functions, otherwise coredumps will only ever contain information about the last remaining thread. Fixes the underlying problem of #4778, though the UI will need refinements to not show every thread's backtrace mashed together.
This commit is contained in:
parent
3718a16f59
commit
057ae36e32
Notes:
sideshowbarker
2024-07-18 23:47:38 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/057ae36e32d Pull-request: https://github.com/SerenityOS/serenity/pull/4963
@ -631,6 +631,8 @@ void Process::finalize()
|
||||
dump_perfcore();
|
||||
}
|
||||
|
||||
m_threads_for_coredump.clear();
|
||||
|
||||
if (m_alarm_timer)
|
||||
TimerQueue::the().cancel_timer(m_alarm_timer.release_nonnull());
|
||||
m_fds.clear();
|
||||
@ -695,6 +697,11 @@ void Process::die()
|
||||
// slave owner, we have to allow the PTY pair to be torn down.
|
||||
m_tty = nullptr;
|
||||
|
||||
for_each_thread([&](auto& thread) {
|
||||
m_threads_for_coredump.append(&thread);
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
|
||||
kill_all_threads();
|
||||
}
|
||||
|
||||
|
@ -663,6 +663,8 @@ private:
|
||||
Thread::WaitBlockCondition m_wait_block_condition;
|
||||
|
||||
HashMap<String, String> m_coredump_metadata;
|
||||
|
||||
Vector<RefPtr<Thread>> m_threads_for_coredump;
|
||||
};
|
||||
|
||||
extern InlineLinkedList<Process>* g_processes;
|
||||
|
Loading…
Reference in New Issue
Block a user