[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [55426] trunk/blender/source/blender/ blenloader/intern/writefile.c: Fix #34697, Undoing a node group crashes Blender.

Lukas Toenne lukas.toenne at googlemail.com
Tue Mar 19 21:37:27 CET 2013


Revision: 55426
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=55426
Author:   lukastoenne
Date:     2013-03-19 20:37:25 +0000 (Tue, 19 Mar 2013)
Log Message:
-----------
Fix #34697, Undoing a node group crashes Blender.

The problem here was that the extra forward compatibility data for node groups (links to the node interface sockets) was written for files as well as undo memfiles. But only in the case of true .blend files is this data subsequently removed again after loading, which in the case of undo leaves invalid links hanging around in the node tree. Forward compat data is now skipped for undo.

Modified Paths:
--------------
    trunk/blender/source/blender/blenloader/intern/writefile.c

Modified: trunk/blender/source/blender/blenloader/intern/writefile.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/writefile.c	2013-03-19 20:16:13 UTC (rev 55425)
+++ trunk/blender/source/blender/blenloader/intern/writefile.c	2013-03-19 20:37:25 UTC (rev 55426)
@@ -3112,8 +3112,11 @@
 #endif
 
 #ifdef USE_NODE_COMPAT_CUSTOMNODES
-	/* deprecated forward compat data is freed again below */
-	customnodes_add_deprecated_data(mainvar);
+	/* don't write compatibility data on undo */
+	if (!current) {
+		/* deprecated forward compat data is freed again below */
+		customnodes_add_deprecated_data(mainvar);
+	}
 #endif
 
 	sprintf(buf, "BLENDER%c%c%.3d", (sizeof(void*)==8)?'-':'_', (ENDIAN_ORDER==B_ENDIAN)?'V':'v', BLENDER_VERSION);
@@ -3162,11 +3165,14 @@
 	writedata(wd, DNA1, wd->sdna->datalen, wd->sdna->data);
 
 #ifdef USE_NODE_COMPAT_CUSTOMNODES
-	/* Ugly, forward compatibility code generates deprecated data during writing,
-	 * this has to be freed again. Can not be done directly after writing, otherwise
-	 * the data pointers could be reused and not be mapped correctly.
-	 */
-	customnodes_free_deprecated_data(mainvar);
+	/* compatibility data not created on undo */
+	if (!current) {
+		/* Ugly, forward compatibility code generates deprecated data during writing,
+		 * this has to be freed again. Can not be done directly after writing, otherwise
+		 * the data pointers could be reused and not be mapped correctly.
+		 */
+		customnodes_free_deprecated_data(mainvar);
+	}
 #endif
 
 	/* end of file */




More information about the Bf-blender-cvs mailing list