diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-02-03 17:08:44 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-02-03 17:08:44 +0400 |
commit | aeea1d394eef4aa8a41f545932cfae66a0487eba (patch) | |
tree | 309a8f645b11ccb4dbd868f2918f10f6c7c1b2f6 /source | |
parent | 050963b6a9529e0abdd597d163ddc4343c0b15c2 (diff) |
Fix #30028: VSE Paste Strip Crash
Crash was caused by invalidation of ID pointers stored in sequencer clipboard
when using undo (undo leads to changes in IDs addresses in memory).
Restore pointers stored in clipboard in the same way as IDs are restoring
for user interface.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 0a92d2ca544..6bd12e8d3f6 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -5309,6 +5309,30 @@ static void *restore_pointer_by_name(Main *mainp, ID *id, int user) return NULL; } +static int lib_link_seq_clipboard_cb(Sequence *seq, void *arg_pt) +{ + Main *newmain = (Main *)arg_pt; + + if(seq->sound) { + seq->sound = restore_pointer_by_name(newmain, (ID *)seq->sound, 0); + seq->sound->id.us++; + } + + if(seq->scene) + seq->scene = restore_pointer_by_name(newmain, (ID *)seq->scene, 1); + + if(seq->scene_camera) + seq->scene_camera = restore_pointer_by_name(newmain, (ID *)seq->scene_camera, 1); + + return 1; +} + +static void lib_link_clipboard_restore(Main *newmain) +{ + /* update IDs stored in sequencer clipboard */ + seqbase_recursive_apply(&seqbase_clipboard, lib_link_seq_clipboard_cb, newmain); +} + /* called from kernel/blender.c */ /* used to link a file (without UI) to the current UI */ /* note that it assumes the old pointers in UI are still valid, so old Main is not freed */ @@ -5516,6 +5540,9 @@ void lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *curscene) sa= sa->next; } } + + /* update IDs stored in all possible clipboards */ + lib_link_clipboard_restore(newmain); } static void direct_link_region(FileData *fd, ARegion *ar, int spacetype) |