[#20958] API: crash on mesh.update() if I unlink and link meshes with the same name...
authorCampbell Barton <ideasman42@gmail.com>
Wed, 10 Feb 2010 09:30:22 +0000 (09:30 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 10 Feb 2010 09:30:22 +0000 (09:30 +0000)
source/blender/blenkernel/intern/sound.c
source/blender/makesrna/intern/rna_scene.c

index ff301fd8f263f044f87da1a23a5cc5822c23565d..35cedbd2d5337265a134e7392df5be342a2e2dab 100644 (file)
@@ -29,6 +29,7 @@
 #include "BKE_library.h"
 #include "BKE_packedFile.h"
 #include "BKE_fcurve.h"
+#include "BKE_animsys.h"
 
 #include "RNA_access.h"
 
index d5a948eccf91709dea04ff08bc5358b18c5a51f3..f61bf8590ebc178a38fbef369f1cdcee7a7051fc 100644 (file)
@@ -169,6 +169,10 @@ static void rna_Scene_unlink_object(Scene *scene, bContext *C, ReportList *repor
        /* as long as ED_base_object_free_and_unlink calls free_libblock_us, we don't have to decrement ob->id.us */
        ED_base_object_free_and_unlink(scene, base);
 
+       /* needed otherwise the depgraph will contain free'd objects which can crash, see [#20958] */
+       DAG_scene_sort(scene);
+       DAG_ids_flush_update(0);
+
        WM_event_add_notifier(C, NC_SCENE|ND_OB_ACTIVE, scene);
 }