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 7afd84df40.
This commit is contained in:
Julian Eisel 2021-12-14 20:57:39 +01:00
parent 4cfa21f09b
commit 40aee0b2e9
1 changed files with 2 additions and 1 deletions

View File

@ -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);
}
}