From c95ad020fb529d47f9c3106a53553bec955c1586 Mon Sep 17 00:00:00 2001 From: lizzie Date: Fri, 11 Sep 2026 15:29:52 +0200 Subject: [gpu] Fix infinite hangup/freezes at shutdown/reset (#4395) Thread may be destroyed at dtor(), but it hasn't fully shut down, so before notify shutdown, request immediate stop (effective immediately). Like the issue was that the thread didn't want to stop running, thus it would hang, it would also reference objects which were being destroyed without waiting for them to actually be destroyed So it would reference invalid data This PR tells the thread: "hey, STOP now, and DESTROY yourself" So all of that should be avoided Signed-off-by: lizzie - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md) - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4395 Reviewed-by: Maufeat Reviewed-by: MaranBr --- src/video_core/gpu_thread.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/video_core/gpu_thread.cpp') diff --git a/src/video_core/gpu_thread.cpp b/src/video_core/gpu_thread.cpp index 2acf9ac458..a01375e7be 100644 --- a/src/video_core/gpu_thread.cpp +++ b/src/video_core/gpu_thread.cpp @@ -114,4 +114,11 @@ u64 ThreadManager::PushCommand(CommandData&& command_data, bool block, bool is_a return fence; } +void ThreadManager::NotifyShutdown() { + if (thread.joinable()) { + thread.request_stop(); + thread.join(); + } +} + } // namespace VideoCommon::GPUThread -- cgit v1.2.3