early-access version 2535

This commit is contained in:
pineappleEA
2022-03-09 03:48:53 +01:00
parent b4dd8f6d3e
commit 870c5bbb4e
5 changed files with 16 additions and 4 deletions

View File

@@ -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