diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-09-01 19:39:56 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-09-01 19:42:37 +0300 |
commit | 7edd60b35b49f73ef96b2ae4d74a1db42f5c4a7c (patch) | |
tree | 9e0e8bfa49d084c39cce01ddda0f28100814e102 /source/blender/gpu/opengl/gl_framebuffer.cc | |
parent | 3c54db4a4e393c26bd92769b16bf6b3fb464ffb0 (diff) |
GLFramebuffer: Avoid calling method on a partially destroyed GLContext
This avoid an ASAN runtime error.
Diffstat (limited to 'source/blender/gpu/opengl/gl_framebuffer.cc')
-rw-r--r-- | source/blender/gpu/opengl/gl_framebuffer.cc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/source/blender/gpu/opengl/gl_framebuffer.cc b/source/blender/gpu/opengl/gl_framebuffer.cc index d7dd5fa23a4..c97f4e2a270 100644 --- a/source/blender/gpu/opengl/gl_framebuffer.cc +++ b/source/blender/gpu/opengl/gl_framebuffer.cc @@ -75,7 +75,13 @@ GLFrameBuffer::GLFrameBuffer( GLFrameBuffer::~GLFrameBuffer() { if (context_ != NULL) { - context_->fbo_free(fbo_id_); + if (context_ == GPU_context_active_get()) { + /* Context might be partially freed. This happens when destroying the window framebuffers. */ + glDeleteFramebuffers(1, &fbo_id_); + } + else { + context_->fbo_free(fbo_id_); + } /* Restore default framebuffer if this framebuffer was bound. */ if (context_->active_fb == this && context_->back_left != this) { /* If this assert triggers it means the framebuffer is being freed while in use by another |