diff options
author | lat9nq <lat9nq@gmail.com> | 2022-03-07 09:35:34 +0100 |
---|---|---|
committer | lat9nq <lat9nq@gmail.com> | 2022-03-08 00:21:56 +0100 |
commit | 1f24a4e520004d48799a27b159432aa0b8634628 (patch) | |
tree | 05162b2eef91dca47877097c2eaf440fb804bd11 /src/core | |
parent | core: Don't shutdown a null GPU (diff) | |
download | yuzu-1f24a4e520004d48799a27b159432aa0b8634628.tar yuzu-1f24a4e520004d48799a27b159432aa0b8634628.tar.gz yuzu-1f24a4e520004d48799a27b159432aa0b8634628.tar.bz2 yuzu-1f24a4e520004d48799a27b159432aa0b8634628.tar.lz yuzu-1f24a4e520004d48799a27b159432aa0b8634628.tar.xz yuzu-1f24a4e520004d48799a27b159432aa0b8634628.tar.zst yuzu-1f24a4e520004d48799a27b159432aa0b8634628.zip |
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/frontend/emu_window.h | 11 |
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 |