Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2013-07-24 10:51:04 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-07-24 10:51:04 +0400
commit576161b18673ef5cd5833330d4bfbf1266c3f624 (patch)
tree4448532c0b4b8aac30cac9d0de0d29e821df4dce /source/blender/blenloader
parentd0f225393cc4c65c1e2e9c2003f3a07eb18db28f (diff)
fix [#36262] Paste strip with video or sound content from another file crashes Blender
existing code was very stupid. - all ID pointers for clipboard strips are handled uniformly. - clipboard stores a duplicate ID pointer which are restored on paste. - restoring pointers... -- use ID's that are still in the database (copy&paste within the same file). -- fallback to name lookup. -- fallback to loading them from the original filepath (movie-clip and sound only). also fix bug pasting where initialing the sound wasn't done if there was no frame-offset.
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r--source/blender/blenloader/intern/readfile.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 3d944300443..1ed22a53251 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -5803,21 +5803,23 @@ static void *restore_pointer_by_name(Main *mainp, ID *id, int user)
return NULL;
}
+static void lib_link_seq_clipboard_pt_restore(ID *id, Main *newmain)
+{
+ if (id) {
+ /* clipboard must ensure this */
+ BLI_assert(id->newid != NULL);
+ id->newid = restore_pointer_by_name(newmain, (ID *)id->newid, 1);
+ }
+}
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);
-
+
+ lib_link_seq_clipboard_pt_restore((ID *)seq->scene, newmain);
+ lib_link_seq_clipboard_pt_restore((ID *)seq->scene_camera, newmain);
+ lib_link_seq_clipboard_pt_restore((ID *)seq->clip, newmain);
+ lib_link_seq_clipboard_pt_restore((ID *)seq->mask, newmain);
+ lib_link_seq_clipboard_pt_restore((ID *)seq->sound, newmain);
return 1;
}