diff options
author | Lukas Toenne <lukas.toenne@googlemail.com> | 2013-03-20 00:37:25 +0400 |
---|---|---|
committer | Lukas Toenne <lukas.toenne@googlemail.com> | 2013-03-20 00:37:25 +0400 |
commit | 42d65dd7ffc360a2bc5c9b35eeaed29c01d4fe3c (patch) | |
tree | 9195fe8784584b31e05a95d1fc3caa64bc508f89 /source/blender | |
parent | d39c6fdf2d7efbb3560038184f43f6bf882c5049 (diff) |
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.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenloader/intern/writefile.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 9a4736449a2..008b3da1768 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -3112,8 +3112,11 @@ static int write_file_handle(Main *mainvar, int handle, MemFile *compare, MemFil #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 @@ static int write_file_handle(Main *mainvar, int handle, MemFile *compare, MemFil 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 */ |