Playanim: Fix heap use after free on exit
authorSergey Sharybin <sergey.vfx@gmail.com>
Tue, 19 Feb 2019 12:08:22 +0000 (13:08 +0100)
committerSergey Sharybin <sergey.vfx@gmail.com>
Tue, 19 Feb 2019 12:08:22 +0000 (13:08 +0100)
Was caused by the wrong de-initialization order, here is
an ASAN log just in case P916.

source/blender/windowmanager/intern/wm_playanim.c

index 58e5882..a8d75ac 100644 (file)
@@ -1540,6 +1540,8 @@ static char *wm_main_playanim_intern(int argc, const char **argv)
 
        GPU_shader_free_builtin_shaders();
 
+       immDeactivate();
+
        if (g_WS.gpu_context) {
                GPU_context_active_set(g_WS.gpu_context);
                GPU_context_discard(g_WS.gpu_context);
@@ -1548,7 +1550,6 @@ static char *wm_main_playanim_intern(int argc, const char **argv)
 
        BLF_exit();
 
-       immDeactivate();
        GPU_exit();
 
        GHOST_DisposeWindow(g_WS.ghost_system, g_WS.ghost_window);