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>2012-09-06 08:45:25 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-09-06 08:45:25 +0400
commit3bb17bd64ab4d9ab2e69ee487a4be4fc0fa8adb8 (patch)
tree5912f02fa9561eebe57c1268e7a1f19feb9e8b2f /source/blender/blenkernel/intern
parent86dd087057f4300fb3ec82844697fb4ef17d2e0f (diff)
fix for crash in sequencer introduced with recent cache addition,
- running undo with metastrips would crash immediately. - freeing a strip without a scene would crash (clipboard does this).
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r--source/blender/blenkernel/intern/sequencer.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index 455a79f305e..849b08fbc2b 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -169,7 +169,7 @@ static void seq_free_strip(Strip *strip)
MEM_freeN(strip);
}
-void BKE_sequence_free(Scene *scene, Sequence *seq)
+void BKE_sequence_free(Scene *scene, Sequence *seq, const int do_cache)
{
if (seq->strip)
seq_free_strip(seq->strip);
@@ -205,21 +205,32 @@ void BKE_sequence_free(Scene *scene, Sequence *seq)
/* free cached data used by this strip,
* also invalidate cache for all dependent sequences
+ *
+ * be _very_ careful here, invalidating cache loops over the scene sequences and
+ * assumes the listbase is valid for all strips, this may not be the case if lists are being freed.
+ * this is optional BKE_sequence_invalidate_cache
*/
- BKE_sequence_invalidate_cache(scene, seq);
+ if (do_cache) {
+ if (scene) {
+ BKE_sequence_invalidate_cache(scene, seq);
+ }
+ }
MEM_freeN(seq);
}
+/* cache must be freed before calling this function
+ * since it leaves the seqbase in an invalid state */
static void seq_free_sequence_recurse(Scene *scene, Sequence *seq)
{
- Sequence *iseq;
+ Sequence *iseq, *iseq_next;
- for (iseq = seq->seqbase.first; iseq; iseq = iseq->next) {
+ for (iseq = seq->seqbase.first; iseq; iseq = iseq_next) {
+ iseq_next = iseq->next;
seq_free_sequence_recurse(scene, iseq);
}
- BKE_sequence_free(scene, seq);
+ BKE_sequence_free(scene, seq, FALSE);
}
@@ -240,7 +251,7 @@ static void seq_free_clipboard_recursive(Sequence *seq_parent)
seq_free_clipboard_recursive(seq);
}
- BKE_sequence_free(NULL, seq_parent);
+ BKE_sequence_free(NULL, seq_parent, FALSE);
}
void BKE_sequencer_free_clipboard(void)
@@ -269,22 +280,21 @@ Editing *BKE_sequencer_editing_ensure(Scene *scene)
void BKE_sequencer_editing_free(Scene *scene)
{
Editing *ed = scene->ed;
- MetaStack *ms;
Sequence *seq;
if (ed == NULL)
return;
+ /* this may not be the active scene!, could be smarter about this */
+ BKE_sequencer_cache_cleanup();
+
SEQ_BEGIN (ed, seq)
{
- BKE_sequence_free(scene, seq);
+ BKE_sequence_free(scene, seq, FALSE);
}
SEQ_END
- while ((ms = ed->metastack.first)) {
- BLI_remlink(&ed->metastack, ms);
- MEM_freeN(ms);
- }
+ BLI_freelistN(&ed->metastack);
MEM_freeN(ed);