Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <julian@blender.org>2021-12-14 22:10:05 +0300
committerJulian Eisel <julian@blender.org>2021-12-14 22:13:58 +0300
commit7afd84df409ac40bc92faaa74181fa13015fe781 (patch)
tree7894d4ecd8b5204196b8578e66f93f3d27b08800 /source/blender/windowmanager
parent7e8912eb969742f9fb12e9d53f3fd1ec968d7032 (diff)
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.
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r--source/blender/windowmanager/intern/wm_surface.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/source/blender/windowmanager/intern/wm_surface.c b/source/blender/windowmanager/intern/wm_surface.c
index 72b68788e79..39bff205cbd 100644
--- a/source/blender/windowmanager/intern/wm_surface.c
+++ b/source/blender/windowmanager/intern/wm_surface.c
@@ -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);