[Bf-blender-cvs] [1b1d6ce] master: Fix T50013: Blender 2.78a Link/Append Crash.

Bastien Montagne noreply at git.blender.org
Sun Nov 13 15:52:19 CET 2016


Commit: 1b1d6ce131c93b8a770c873460dce429796849a3
Author: Bastien Montagne
Date:   Sun Nov 13 15:49:41 2016 +0100
Branches: master
https://developer.blender.org/rB1b1d6ce131c93b8a770c873460dce429796849a3

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...).

===================================================================

M	source/blender/blenkernel/intern/library.c

===================================================================

diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index 024fa3b..e5b066a 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;
 		}
 	}




More information about the Bf-blender-cvs mailing list