summaryrefslogtreecommitdiff
path: root/src/core/frontend
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2022-03-08 12:36:57 -0800
committerGitHub <noreply@github.com>2022-03-08 12:36:57 -0800
commitf2743b41b0f8f82bcfe678cf735819ea987b62b4 (patch)
treef5cd00237eda3d4ea49a434e8f01f2a912ded9ce /src/core/frontend
parent35309f27ed129dfda8b6ba7f126bf22f12bb9b4c (diff)
parentb5e60ae1b0568d6c9e47134dd2bda70906a2dad9 (diff)
Merge pull request #7986 from lat9nq/vk-callback
core, video_core: Fix two crashes when failing to create the emulated GPU instance
Diffstat (limited to 'src/core/frontend')
-rw-r--r--src/core/frontend/emu_window.h11
1 files changed, 10 insertions, 1 deletions
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