Fix T62355: Running blender 2.80 headless broken in recent builds
authorClément Foucault <foucault.clem@gmail.com>
Fri, 8 Mar 2019 13:31:58 +0000 (14:31 +0100)
committerClément Foucault <foucault.clem@gmail.com>
Fri, 8 Mar 2019 13:32:04 +0000 (14:32 +0100)
source/blender/draw/intern/draw_manager.c

index 916cea8..fe55874 100644 (file)
@@ -2587,6 +2587,13 @@ void DRW_engines_register(void)
 
 void DRW_engines_free(void)
 {
+       if (DST.gl_context == NULL) {
+               /* Nothing has been setup. Nothing to clear.
+                * Otherwise, DRW_opengl_context_enable can
+                * create a context in background mode. (see T62355) */
+               return;
+       }
+
        DRW_opengl_context_enable();
 
        DRW_TEXTURE_FREE_SAFE(g_select_buffer.texture_depth);