diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2016-11-13 17:49:41 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2016-11-13 17:49:41 +0300 |
commit | 1b1d6ce131c93b8a770c873460dce429796849a3 (patch) | |
tree | 26d84d68be03d5840f7417a57dc4ae89ead95fa1 /source | |
parent | 7e8bf9dbd6836bf71a87c787a92768f78cb68e89 (diff) |
Fix T50013: Blender 2.78a Link/Append Crash.
Object freeing may in some kind access its obdata (in case it has some
caches e.g.), since here obdata may have already been freed, let's set
object's data pointer to NULL (probably not ideal solution, but we don't
care much, those form archipelagos of unused linked datablocks,
we nuke'em all anyway).
Also fix stupid mistake in one of own recent commits (using ID we just
freed, tsst...).
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/library.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 024fa3b5952..e5b066a3c26 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -1841,6 +1841,12 @@ void BKE_library_make_local( /* Note: in theory here we are only handling datablocks forming exclusive linked dependency-cycles-based * archipelagos, so no need to check again after we have deleted one, as done in previous step. */ if (id->tag & LIB_TAG_DOIT) { + /* Object's deletion rely on valid ob->data, but ob->data may have already been freed here... + * Setting it to NULL may not be 100% correct, but should be safe and do the work. */ + if (GS(id->name) == ID_OB) { + ((Object *)id)->data = NULL; + } + /* Note: *in theory* IDs tagged here are fully *outside* of file scope, totally unused, so we can * directly wipe them out without caring about clearing their usages. * However, this is a highly-risky presumption, and nice crasher in case something goes wrong here. @@ -1853,7 +1859,6 @@ void BKE_library_make_local( #endif ((LinkNode *)it->link)->link = NULL; /* Not strictly necessary, but safer (see T49903)... */ it->link = NULL; - id->tag &= ~LIB_TAG_DOIT; } } |