summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2022-03-08 21:36:57 +0100
committerGitHub <noreply@github.com>2022-03-08 21:36:57 +0100
commitf2743b41b0f8f82bcfe678cf735819ea987b62b4 (patch)
treef5cd00237eda3d4ea49a434e8f01f2a912ded9ce /src/core
parentMerge pull request #7989 from degasus/maxwell_LUT3 (diff)
parentvideo_core: Cancel Scoped's exit call on GPU failure (diff)
downloadyuzu-f2743b41b0f8f82bcfe678cf735819ea987b62b4.tar
yuzu-f2743b41b0f8f82bcfe678cf735819ea987b62b4.tar.gz
yuzu-f2743b41b0f8f82bcfe678cf735819ea987b62b4.tar.bz2
yuzu-f2743b41b0f8f82bcfe678cf735819ea987b62b4.tar.lz
yuzu-f2743b41b0f8f82bcfe678cf735819ea987b62b4.tar.xz
yuzu-f2743b41b0f8f82bcfe678cf735819ea987b62b4.tar.zst
yuzu-f2743b41b0f8f82bcfe678cf735819ea987b62b4.zip
Diffstat (limited to 'src/core')
-rw-r--r--src/core/core.cpp4
-rw-r--r--src/core/frontend/emu_window.h11
2 files changed, 13 insertions, 2 deletions
diff --git a/src/core/core.cpp b/src/core/core.cpp
index b0cfee3ee..c60a784c3 100644
--- a/src/core/core.cpp
+++ b/src/core/core.cpp
@@ -326,7 +326,9 @@ struct System::Impl {
is_powered_on = false;
exit_lock = false;
- gpu_core->NotifyShutdown();
+ if (gpu_core != nullptr) {
+ gpu_core->NotifyShutdown();
+ }
services.reset();
service_manager.reset();
diff --git a/src/core/frontend/emu_window.h b/src/core/frontend/emu_window.h
index e413a520a..b3bffecb2 100644
--- a/src/core/frontend/emu_window.h
+++ b/src/core/frontend/emu_window.h
@@ -42,11 +42,20 @@ public:
context.MakeCurrent();
}
~Scoped() {
- context.DoneCurrent();
+ if (active) {
+ context.DoneCurrent();
+ }
+ }
+
+ /// In the event that context was destroyed before the Scoped is destroyed, this provides a
+ /// mechanism to prevent calling a destroyed object's method during the deconstructor
+ void Cancel() {
+ active = false;
}
private:
GraphicsContext& context;
+ bool active{true};
};
/// Calls MakeCurrent on the context and calls DoneCurrent when the scope for the returned value