diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mbgl/gl/context.cpp | 4 | ||||
-rw-r--r-- | src/mbgl/gl/context.hpp | 6 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/mbgl/gl/context.cpp b/src/mbgl/gl/context.cpp index b8a0502178..d0c538efb0 100644 --- a/src/mbgl/gl/context.cpp +++ b/src/mbgl/gl/context.cpp @@ -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) { diff --git a/src/mbgl/gl/context.hpp b/src/mbgl/gl/context.hpp index 228e6e55b7..528113cbba 100644 --- a/src/mbgl/gl/context.hpp +++ b/src/mbgl/gl/context.hpp @@ -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 |