T006
HIGH
OPEN
29 Jun 2026
Blender crash on bulk object deletion - stale depsgraph references
Blender crashes during viewport redraw after GAAD scripts bulk-delete ~200+ objects. Root cause is a Blender core bug: the DEG iterator holds stale references to deleted objects, and DRW_cache_free_old_batches dereferences a null base pointer at offset 0xB8. The scripts already use the safer bpy.data.objects.remove() path (not bpy.ops.object.delete()), but no depsgraph flush is issued between deletion and the next viewport-triggering operation. Affected locations: (1) generator clear_scene() - delete_collection_hierarchy() + orphan cleanup, no depsgraph update before purge_orphans()/frame_all_views(); (2) addon Reset operator Steps 3-5 - bulk remove in a loop, no depsgraph fence before Step 6 scene property writes. Fix: add bpy.context.view_layer.depsgraph.update() after each bulk deletion block and before any operation that could trigger a viewport redraw. Also worth reporting to Blender bug tracker as a legitimate engine-level issue with scripted bulk deletion workflows.
CONFIRMED 02 Jul 2026 by a full crash log from Miles (Blender 5.1.2, Windows): EXCEPTION_ACCESS_VIOLATION reading offset 0xB8 in DEG_iterator_objects_next -> DRW_cache_free_old_batches -> view3d_main_region_draw, immediately after Reset GAAD Platform reported 'Emptied 18 objects'. Two earlier resets the same session (123 and 59 objects) survived; the third crashed on a tiny scene - confirming a timing race, not an object-count problem, exactly as diagnosed above. Miles also reported general panel fragility around Generator <-> Navigator scene switching, which widens the same window (the incoming scene bulk-rebuilds while its draw cache is still warming).
FIX SHIPPED in gaad_rebirth_addon_v0_66.py (bundle 0_107), awaiting retest: (1) _gaad_safe_state() deselects everything and clears the active object in every scene before any bulk-destructive work, so the draw manager holds no references into objects about to be removed; (2) Reset's three per-object removal loops replaced by single atomic bpy.data.batch_remove() sweeps - one for objects, one for the mesh datablocks and GAAD materials orphaned by the removal (these previously accumulated forever); (3) _gaad_settle() runs view_layer.update() on all scenes plus a tagged 3D-viewport redraw before the operator returns, so the depsgraph is coherent before the next draw instead of racing it; (4) _run_script() brackets every generator/tree/report run with the same safe-state/settle pair, protecting the generator's previous-generation purge and the tree's Navigator rebuild without modifying those scripts; (5) scene-switch operators (gaad.generate, gaad.back_to_generation) settle the incoming scene's depsgraph immediately after context.window.scene changes. Reset logic verified by out-of-Blender dry-run: protected objects kept, strays and Navigator objects gathered into one sweep, shared materials never removed, selection/active cleared first, depsgraph settled after. Status stays open until Miles's in-Blender retest (repeat resets, scene switching, generations at 3x3 and 5x5) passes.
STATUS NOTE 03 Jul 2026: multiple long sessions through bundles 0_108-0_110 (13+ generations, repeated resets and scene switches during panel UX testing) with no crash reported since the v0_66/v0_67 fixes - an encouraging signal, but the explicit hammer-test verdict from Miles (repeat resets, aggressive Generator <-> Navigator switching, 3x3 and 5x5 and 9x9 generations) remains outstanding before this closes. Tracked in CURRENT_ACTIONS.md.
Resolution
Fix shipped in addon v0_66 (bundle 0_107) - safe-state + atomic batch_remove + depsgraph settle. Awaiting retest.
T004