Fix possible use-after-free on error handling during VR view drawing

Whenever an exception happens in VR session code, we cancel the entire
session. Alongside that, we removed the "surface" item used to draw into
an offscreen context. But this may still be stored as active surface,
leading to a use-after-free when deactivating this active surface, for
example.
This commit is contained in:
Julian Eisel 2021-12-14 20:10:05 +01:00
parent 7e8912eb96
commit 7afd84df40
Notes: blender-bot 2023-02-14 02:30:10 +01:00
Referenced by commit 40aee0b2e9, Fix possible use-after-free on error handling during VR view drawing
1 changed files with 3 additions and 0 deletions

View File

@ -119,6 +119,9 @@ 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);
surface->free_data(surface);
MEM_freeN(surface);