Fix T48604: Crash on undo due to bad drawing code.
Short story: draw_lamp would add itself to delayed transp drawing list from 'xray' drawing step. This was broken, since delayed transp drawing list is always handled **before** delayed xray one. After undo it lead to segfault crash, v3d->afterdraw_transp still having reference to old freed scene's base. Also added asserts that those afterdraw list are empty at end of drawing step, should help avoiding that kind of issue in future.
This commit is contained in:
parent
2033f47e55
commit
055001111e
Notes:
blender-bot
2023-02-14 11:08:33 +01:00
Referenced by issue #48604, Crash when using Ctrl-Z on the Render layer
|
@ -1209,7 +1209,7 @@ static void drawlamp(View3D *v3d, RegionView3D *rv3d, Base *base,
|
|||
|
||||
if ((drawcone || drawshadowbox) && !v3d->transp) {
|
||||
/* in this case we need to draw delayed */
|
||||
ED_view3d_after_add(&v3d->afterdraw_transp, base, dflag);
|
||||
ED_view3d_after_add(v3d->xray ? &v3d->afterdraw_xraytransp : &v3d->afterdraw_transp, base, dflag);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -4061,6 +4061,10 @@ void view3d_main_region_draw(const bContext *C, ARegion *ar)
|
|||
view3d_main_region_draw_info(C, scene, ar, v3d, grid_unit, render_border);
|
||||
|
||||
v3d->flag |= V3D_INVALID_BACKBUF;
|
||||
|
||||
BLI_assert(BLI_listbase_is_empty(&v3d->afterdraw_transp));
|
||||
BLI_assert(BLI_listbase_is_empty(&v3d->afterdraw_xray));
|
||||
BLI_assert(BLI_listbase_is_empty(&v3d->afterdraw_xraytransp));
|
||||
}
|
||||
|
||||
#ifdef DEBUG_DRAW
|
||||
|
|
Loading…
Reference in New Issue