Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2016-11-04 11:55:46 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2016-11-04 11:55:46 +0300
commitf0ac661aa8362f5c990b238a2366e2730cd4cb72 (patch)
tree767486f9f505b7c4de81f845c5a6c427ac6ad512 /source/blender/editors/object/object_relations.c
parent17fb504bcf5b9c1288e1e5bf9c9b0ebbbc99f96d (diff)
Fix T49905: Segfault when copying object data of linked object.
We have to clear `newid` of all datablocks, not only object ones. Note that this whole stuff is still using some kind of older, primitive 'ID remapping', would like to see whether we can replace it with new, more generic one, but that's for another day.
Diffstat (limited to 'source/blender/editors/object/object_relations.c')
-rw-r--r--source/blender/editors/object/object_relations.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index 16ee6f4ed89..f448e925dd9 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -1740,10 +1740,16 @@ static void single_object_users(Main *bmain, Scene *scene, View3D *v3d, const in
clear_sca_new_poins(); /* sensor/contr/act */
- /* newid may still have some trash from Outliner tree building,
- * so clear that first to avoid errors [#26002] */
- for (ob = bmain->object.first; ob; ob = ob->id.next)
- ob->id.newid = NULL;
+ /* newid may still have some trash from Outliner tree building, so clear that first to avoid errors, see T26002.
+ * We have to clear whole datablocks, not only Object one may be accessed here, see T49905. */
+ ListBase *lbarray[MAX_LIBARRAY];
+ int a = set_listbasepointers(bmain, lbarray);
+ while (a--) {
+ ListBase *lb = lbarray[a];
+ for (ID *id = lb->first; id; id = id->next) {
+ id->newid = NULL;
+ }
+ }
/* duplicate (must set newid) */
for (base = FIRSTBASE; base; base = base->next) {