diff options
author | Julian Eisel <julian@blender.org> | 2021-12-14 22:57:39 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2021-12-14 22:57:39 +0300 |
commit | 40aee0b2e921dbbd4beeaaa4314c5f228600a47f (patch) | |
tree | ef7e84291ab009eac2ed74507370b8159302199c /source/blender/windowmanager/intern/wm_surface.c | |
parent | 4cfa21f09b3878141d6de5b3fc5219527fb6dfc3 (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. This would mess up the iterator of the surface
draw loop.
Similar to 7afd84df409a.
Diffstat (limited to 'source/blender/windowmanager/intern/wm_surface.c')
-rw-r--r-- | source/blender/windowmanager/intern/wm_surface.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/source/blender/windowmanager/intern/wm_surface.c b/source/blender/windowmanager/intern/wm_surface.c index 39bff205cbd..385b55f36f9 100644 --- a/source/blender/windowmanager/intern/wm_surface.c +++ b/source/blender/windowmanager/intern/wm_surface.c @@ -45,7 +45,8 @@ static wmSurface *g_drawable = NULL; void wm_surfaces_iter(bContext *C, void (*cb)(bContext *C, wmSurface *)) { - LISTBASE_FOREACH (wmSurface *, surf, &global_surface_list) { + /* Mutable iterator in case a surface is freed. */ + LISTBASE_FOREACH_MUTABLE (wmSurface *, surf, &global_surface_list) { cb(C, surf); } } |