[core] allow context to be abandoned on destruction
- This enables the use case where the system already destroyed the underlying GL resources. Otherwise, the cleanup would fail and crash
This commit is contained in:
committed by
Ivo van Dongen
parent
e0312ef208
commit
6211db6968
@@ -87,7 +87,9 @@ static_assert(std::is_same<BinaryProgramFormat, GLenum>::value, "OpenGL type mis
|
||||
Context::Context() = default;
|
||||
|
||||
Context::~Context() {
|
||||
reset();
|
||||
if (cleanupOnDestruction) {
|
||||
reset();
|
||||
}
|
||||
}
|
||||
|
||||
void Context::initializeExtensions(const std::function<gl::ProcAddress(const char*)>& getProcAddress) {
|
||||
|
||||
@@ -190,7 +190,13 @@ public:
|
||||
return vertexArray.get();
|
||||
}
|
||||
|
||||
void setCleanupOnDestruction(bool cleanup) {
|
||||
cleanupOnDestruction = cleanup;
|
||||
}
|
||||
|
||||
private:
|
||||
bool cleanupOnDestruction = true;
|
||||
|
||||
std::unique_ptr<extension::Debugging> debugging;
|
||||
std::unique_ptr<extension::VertexArray> vertexArray;
|
||||
#if MBGL_HAS_BINARY_PROGRAMS
|
||||
|
||||
Reference in New Issue
Block a user