Bugfix #25427
authorTon Roosendaal <ton@blender.org>
Fri, 31 Dec 2010 12:37:30 +0000 (12:37 +0000)
committerTon Roosendaal <ton@blender.org>
Fri, 31 Dec 2010 12:37:30 +0000 (12:37 +0000)
Serious *bad* crash in undo introduced by commit Janne dec 21st.

Time window now stores some kind of cache for fluids/cloth, but
it's pointing (in SpaceTime) to data inside Objects. (Not ID).

That's really not allowed... this commit fixes crashes but the
cache code really needs to be redesigned. I'm also afraid this
crash is going to frustrate everyone using physics...

source/blender/blenloader/intern/readfile.c

index 0dfdd46d17b7e6a1f1d93765d5dc82782eb50660..fdac9753cdde7ef0abd98c5345877a7162a69b11 100644 (file)
@@ -4984,6 +4984,15 @@ void lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *curscene)
 
                                        ssound->sound= restore_pointer_by_name(newmain, (ID *)ssound->sound, 1);
                                }
+                               else if(sl->spacetype==SPACE_TIME) {
+                                       SpaceTime *stime= (SpaceTime *)sl;
+                                       SpaceTimeCache *stc;
+                                       
+                                       /* XXX bad linking of internal object data to space */
+                                       for (stc= stime->caches.first; stc; stc=stc->next)
+                                               MEM_freeN(stc->array);
+                                       BLI_freelistN(&stime->caches);
+                               }
                                else if(sl->spacetype==SPACE_NODE) {
                                        SpaceNode *snode= (SpaceNode *)sl;