diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-02-28 18:25:09 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-02-28 18:25:09 +0400 |
commit | 5cb22bbedf2169df23cf8ad894b2c0cad5e68244 (patch) | |
tree | c4270e06d685c94865ab71a6302fc72ab76c97af /source/blender/blenkernel | |
parent | efdca34f524b8bb36edda5cbef07d13bad089d01 (diff) |
Fix sequencer crash when pasteing strips after creating new file
Issue happened for scene. movie clip and mask strips, which contains
pointers to datablocks which are freeing on loading new file.
Also, scene strip would crash when pasted from clipboard after scene
was unlinked from file.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_sequencer.h | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/mask.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/movieclip.c | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/scene.c | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/sequencer.c | 27 |
5 files changed, 38 insertions, 3 deletions
diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h index eef134a6872..c0ff634671d 100644 --- a/source/blender/blenkernel/BKE_sequencer.h +++ b/source/blender/blenkernel/BKE_sequencer.h @@ -36,6 +36,7 @@ struct Editing; struct ImBuf; struct Main; struct Mask; +struct MovieClip; struct Scene; struct Sequence; struct SequenceModifierData; @@ -322,6 +323,8 @@ void BKE_sequence_base_dupli_recursive(struct Scene *scene, struct Scene *scene_ int BKE_sequence_is_valid_check(struct Sequence *seq); void BKE_sequencer_clear_scene_in_allseqs(struct Main *bmain, struct Scene *sce); +void BKE_sequencer_clear_movieclip_in_clipboard(struct MovieClip *clip); +void BKE_sequencer_clear_mask_in_clipboard(struct Mask *mask); struct Sequence *BKE_sequence_get_by_name(struct ListBase *seqbase, const char *name, int recursive); diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c index 960432d6b3d..87802ab8ee6 100644 --- a/source/blender/blenkernel/intern/mask.c +++ b/source/blender/blenkernel/intern/mask.c @@ -923,6 +923,8 @@ void BKE_mask_free(Main *bmain, Mask *mask) SpaceLink *sl; Scene *scene; + BKE_sequencer_clear_mask_in_clipboard(mask); + for (scr = bmain->screen.first; scr; scr = scr->id.next) { for (area = scr->areabase.first; area; area = area->next) { for (sl = area->spacedata.first; sl; sl = sl->next) { diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c index 2702d5b3f0a..b748f8cbdd3 100644 --- a/source/blender/blenkernel/intern/movieclip.c +++ b/source/blender/blenkernel/intern/movieclip.c @@ -75,6 +75,7 @@ #include "BKE_node.h" #include "BKE_image.h" /* openanim */ #include "BKE_tracking.h" +#include "BKE_sequencer.h" #include "IMB_colormanagement.h" #include "IMB_imbuf_types.h" @@ -1292,6 +1293,8 @@ void BKE_movieclip_build_proxy_frame(MovieClip *clip, int clip_flag, struct Movi void BKE_movieclip_free(MovieClip *clip) { + BKE_sequencer_clear_movieclip_in_clipboard(clip); + free_buffers(clip); BKE_tracking_free(&clip->tracking); diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index c8346971d1c..83b2648ee50 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -290,6 +290,9 @@ void BKE_scene_free(Scene *sce) { Base *base; + /* check all sequences */ + BKE_sequencer_clear_scene_in_allseqs(G.main, sce); + base = sce->base.first; while (base) { base->object->id.us--; @@ -693,9 +696,6 @@ void BKE_scene_unlink(Main *bmain, Scene *sce, Scene *newsce) if (sce1->set == sce) sce1->set = NULL; - /* check all sequences */ - BKE_sequencer_clear_scene_in_allseqs(bmain, sce); - /* check render layer nodes in other scenes */ clear_scene_in_nodes(bmain, sce); diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index b0a65d23d93..613c02c173b 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -815,6 +815,33 @@ void BKE_sequencer_clear_scene_in_allseqs(Main *bmain, Scene *scene) BKE_sequencer_base_recursive_apply(&scene_iter->ed->seqbase, clear_scene_in_allseqs_cb, scene); } } + + /* also clear clipboard */ + BKE_sequencer_base_recursive_apply(&seqbase_clipboard, clear_scene_in_allseqs_cb, scene); +} + +static int clear_movieclip_in_clipboard_cb(Sequence *seq, void *arg_pt) +{ + if (seq->clip == (MovieClip *)arg_pt) + seq->clip = NULL; + return 1; +} + +void BKE_sequencer_clear_movieclip_in_clipboard(MovieClip *clip) +{ + BKE_sequencer_base_recursive_apply(&seqbase_clipboard, clear_movieclip_in_clipboard_cb, clip); +} + +static int clear_mask_in_clipboard_cb(Sequence *seq, void *arg_pt) +{ + if (seq->mask == (Mask *)arg_pt) + seq->mask = NULL; + return 1; +} + +void BKE_sequencer_clear_mask_in_clipboard(Mask *mask) +{ + BKE_sequencer_base_recursive_apply(&seqbase_clipboard, clear_mask_in_clipboard_cb, mask); } typedef struct SeqUniqueInfo { |