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-08-13 21:25:03 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-08-13 21:25:03 +0400
commitbe513d1b15630b629d09a6fdfa6ada808586a9dc (patch)
tree04e41990bcdb34d645ed14c073e4e31aa5670937 /source/blender/blenkernel/intern
parent7a3b44cf69b009fc77ffc361f5500e20131faa59 (diff)
fix for missing NULL checks when sequence-strip pointers become NULL because of problems with library linking.
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r--source/blender/blenkernel/intern/mask.c71
-rw-r--r--source/blender/blenkernel/intern/sequencer.c6
2 files changed, 71 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c
index 4b4dcff229d..3c46e7bcd47 100644
--- a/source/blender/blenkernel/intern/mask.c
+++ b/source/blender/blenkernel/intern/mask.c
@@ -40,18 +40,22 @@
#include "BLI_math.h"
#include "DNA_mask_types.h"
+#include "DNA_node_types.h"
#include "DNA_scene_types.h"
#include "DNA_object_types.h"
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
#include "DNA_movieclip_types.h"
#include "DNA_tracking_types.h"
+#include "DNA_sequence_types.h"
#include "BKE_curve.h"
#include "BKE_global.h"
#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_mask.h"
+#include "BKE_node.h"
+#include "BKE_sequencer.h"
#include "BKE_tracking.h"
#include "BKE_movieclip.h"
#include "BKE_utildefines.h"
@@ -1561,26 +1565,83 @@ void BKE_mask_free(Mask *mask)
BKE_mask_layer_free_list(&mask->masklayers);
}
+
+static void ntree_unlink_mask_cb(void *calldata, struct ID *UNUSED(owner_id), struct bNodeTree *ntree)
+{
+ ID *id = (ID *)calldata;
+ bNode *node;
+
+ for (node = ntree->nodes.first; node; node = node->next) {
+ if (node->id == id) {
+ node->id = NULL;
+ }
+ }
+}
+
void BKE_mask_unlink(Main *bmain, Mask *mask)
{
bScreen *scr;
ScrArea *area;
SpaceLink *sl;
+ Scene *scene;
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) {
- if (sl->spacetype == SPACE_CLIP) {
- SpaceClip *sc = (SpaceClip *) sl;
+ switch (sl->spacetype) {
+ case SPACE_CLIP:
+ {
+ SpaceClip *sc = (SpaceClip *)sl;
- if (sc->mask_info.mask == mask)
- sc->mask_info.mask = NULL;
+ if (sc->mask_info.mask == mask) {
+ sc->mask_info.mask = NULL;
+ }
+ break;
+ }
+ case SPACE_IMAGE:
+ {
+ SpaceImage *sima = (SpaceImage *)sl;
+
+ if (sima->mask_info.mask == mask) {
+ sima->mask_info.mask = NULL;
+ }
+ break;
+ }
}
}
}
}
- mask->id.us = 0;
+ for (scene = bmain->scene.first; scene; scene = scene->id.next) {
+ if (scene->ed) {
+ Sequence *seq;
+
+ SEQ_BEGIN (scene->ed, seq)
+ {
+ if (seq->mask == mask) {
+ seq->mask = NULL;
+ }
+ }
+ SEQ_END
+ }
+
+
+ if (scene->nodetree) {
+ bNode *node;
+ for (node = scene->nodetree->nodes.first; node; node = node->next) {
+ if (node->id == &mask->id) {
+ node->id = NULL;
+ }
+ }
+ }
+ }
+
+ {
+ bNodeTreeType *treetype = ntreeGetType(NTREE_COMPOSIT);
+ treetype->foreach_nodetree(bmain, (void *)mask, &ntree_unlink_mask_cb);
+ }
+
+ BKE_libblock_free(&bmain->mask, mask);
}
void BKE_mask_coord_from_frame(float r_co[2], const float co[2], const float frame_size[2])
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index 0432e7a62a2..528b9dff164 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -594,6 +594,9 @@ void BKE_sequence_reload_new_file(Scene *scene, Sequence *seq, int lock_range)
}
break;
case SEQ_TYPE_MOVIECLIP:
+ if (seq->clip == NULL)
+ return;
+
seq->len = BKE_movieclip_get_duration(seq->clip);
seq->len -= seq->anim_startofs;
@@ -603,8 +606,9 @@ void BKE_sequence_reload_new_file(Scene *scene, Sequence *seq, int lock_range)
}
break;
case SEQ_TYPE_MASK:
+ if (seq->mask == NULL)
+ return;
seq->len = BKE_mask_get_duration(seq->mask);
-
seq->len -= seq->anim_startofs;
seq->len -= seq->anim_endofs;
if (seq->len < 0) {