Fix T100130: animation player crash on exit

GPU_exit is now expected to run within an active GPU context.

Also run BLF_exit and IMB_exit first they can use GPU resources and gave
ASAN errors. And remove redundant GPU_shader_free_builtin_shaders already
handled by GPU_exit.
This commit is contained in:
Brecht Van Lommel 2022-08-11 19:03:20 +02:00
parent 0a096f2be2
commit 6161b8dc63
Notes: blender-bot 2023-02-14 03:00:45 +01:00
Referenced by issue #100130, Regression: Closing the view animation window crashes Blender
1 changed files with 9 additions and 11 deletions

View File

@ -1807,20 +1807,21 @@ static char *wm_main_playanim_intern(int argc, const char **argv)
AUD_Sound_free(source);
source = NULL;
#endif
/* we still miss freeing a lot!,
* but many areas could skip initialization too for anim play */
GPU_shader_free_builtin_shaders();
if (g_WS.gpu_context) {
GPU_context_active_set(g_WS.gpu_context);
GPU_context_discard(g_WS.gpu_context);
g_WS.gpu_context = NULL;
}
IMB_exit();
DEG_free_node_types();
BLF_exit();
GPU_exit();
if (g_WS.gpu_context) {
GPU_context_active_set(g_WS.gpu_context);
GPU_exit();
GPU_context_discard(g_WS.gpu_context);
g_WS.gpu_context = NULL;
}
GHOST_DisposeWindow(g_WS.ghost_system, g_WS.ghost_window);
@ -1830,9 +1831,6 @@ static char *wm_main_playanim_intern(int argc, const char **argv)
return filepath;
}
IMB_exit();
DEG_free_node_types();
totblock = MEM_get_memory_blocks_in_use();
if (totblock != 0) {
/* prints many bAKey, bArgument's which are tricky to fix */