Fix #114189: Workbench: VR Session crashes on exit

Ensure there's a valid GPU context when freeing a wm_surface.

Pull Request: https://projects.blender.org/blender/blender/pulls/114795
This commit is contained in:
Miguel Pozo
2023-11-13 15:35:11 +01:00
parent b98bc26173
commit aef7a17aa5

View File

@@ -108,18 +108,16 @@ void wm_surface_add(wmSurface *surface)
void wm_surface_remove(wmSurface *surface)
{
if (surface == g_drawable) {
wm_surface_clear_drawable();
}
BLI_remlink(&global_surface_list, surface);
/* Ensure GPU context is bound to free GPU resources. */
wm_surface_make_drawable(surface);
surface->free_data(surface);
wm_surface_clear_drawable();
MEM_freeN(surface);
}
void wm_surfaces_free()
{
wm_surface_clear_drawable();
LISTBASE_FOREACH_MUTABLE (wmSurface *, surf, &global_surface_list) {
wm_surface_remove(surf);
}