Fix T86992: Tagged ID deletion conflicts with freeing objects

Check LIB_TAG_COPIED_ON_WRITE instead of LIB_TAG_NO_MAIN,
matching the behavior of rigid-body shared data.
This commit is contained in:
Campbell Barton
2021-03-28 18:16:07 +11:00
parent 5b1980859a
commit 46d980228b
2 changed files with 3 additions and 9 deletions

View File

@@ -3181,9 +3181,11 @@ void sbFree(Object *ob)
return;
}
const bool is_orig = (ob->id.tag & LIB_TAG_COPIED_ON_WRITE) == 0;
free_softbody_intern(sb);
if ((ob->id.tag & LIB_TAG_NO_MAIN) == 0) {
if (is_orig) {
/* Only free shared data on non-CoW copies */
BKE_ptcache_free_list(&sb->shared->ptcaches);
sb->shared->pointcache = NULL;

View File

@@ -1997,15 +1997,7 @@ static int object_delete_exec(bContext *C, wmOperator *op)
}
if (tagged_count > 0) {
#if 0 /* Temporary workaround for bug in tagged delete, see: T86992 */
BKE_id_multi_tagged_delete(bmain);
#else
LISTBASE_FOREACH_MUTABLE (Object *, ob, &bmain->objects) {
if (ob->id.tag & LIB_TAG_DOIT) {
BKE_id_delete(bmain, &ob->id);
}
}
#endif
}
BKE_reportf(op->reports, RPT_INFO, "Deleted %u object(s)", (changed_count + tagged_count));