VERY experimental Nintendo Switch 2 emulator
C++
emu_window: Create a way to Cancel the exit of a Scoped
lat9nqe3f8340bec78
diff --git a/src/core/frontend/emu_window.h b/src/core/frontend/emu_window.hindex e413a520ab..b3bffecb22 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