aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlizzie <lizzie@eden-emu.dev>2026-09-08 20:40:19 +0200
committercrueter <crueter@eden-emu.dev>2026-09-08 20:40:19 +0200
commitce202292cfb668bcf45e64172cd40c8972eff7f5 (patch)
treebdbc8600d8e7ec18606b37b716256d3513aa9211
parent87e5d0b6e490d56fbbe4e770a80e2fbd31aff2ae (diff)
[gpu] Destroy GPU thread after all non-trivial members had been destroyed (#4368)
Should help fix any game hangs after closing the emulator, or sporadic hangs when restarting. Signed-off-by: lizzie <lizzie@eden-emu.dev> - [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/4368 Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Reviewed-by: Maufeat <sahyno1996@gmail.com>
-rw-r--r--src/video_core/gpu.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp
index ff7dafb222..a2e87b260a 100644
--- a/src/video_core/gpu.cpp
+++ b/src/video_core/gpu.cpp
@@ -55,11 +55,11 @@ constexpr u64 GpuClockMultiplier(Settings::GpuClock clock) {
struct GPU::Impl {
explicit Impl(Core::System& system_, bool is_async_, bool use_nvdec_)
- : system{system_}
+ : gpu_thread{system_}
+ , system{system_}
, use_nvdec{use_nvdec_}
, shader_notify()
, is_async{is_async_}
- , gpu_thread{system_}
{}
~Impl() = default;
@@ -301,6 +301,10 @@ struct GPU::Impl {
return out;
}
+ // Destruction of thread must be done before all (non trivial)
+ // previous members has been destroyed
+ VideoCommon::GPUThread::ThreadManager gpu_thread;
+
Core::System& system;
std::unique_ptr<VideoCore::RendererBase> renderer;
@@ -329,7 +333,6 @@ struct GPU::Impl {
const bool is_async;
- VideoCommon::GPUThread::ThreadManager gpu_thread;
std::unique_ptr<Core::Frontend::GraphicsContext> cpu_context;
Tegra::Control::Scheduler scheduler;