Fix a segfault in the tracker caused by attempting a one-frame track after the active...
authorKeir Mierle <mierle@gmail.com>
Sun, 4 Dec 2011 04:51:30 +0000 (04:51 +0000)
committerKeir Mierle <mierle@gmail.com>
Sun, 4 Dec 2011 04:51:30 +0000 (04:51 +0000)
source/blender/blenkernel/intern/tracking.c

index be7b486be40a1115a96c3165575b45b9ed8aa759..a5cf355757fefee2a15173289e7fc0b875993f8a 100644 (file)
@@ -766,11 +766,13 @@ MovieTrackingContext *BKE_tracking_context_new(MovieClip *clip, MovieClipUser *u
                track= track->next;
        }
 
+       /* add a context even if there are no tracks, since this is needed if the user tries to track
+        * on a frame where their tracker is disabled. */
+       context->tracks_map= tracks_map_new(num_tracks, sizeof(TrackContext));
+
        if(num_tracks) {
                int width, height;
 
-               context->tracks_map= tracks_map_new(num_tracks, sizeof(TrackContext));
-
                BKE_movieclip_get_size(clip, user, &width, &height);
 
                /* create tracking data */
@@ -1133,7 +1135,7 @@ int BKE_tracking_next(MovieTrackingContext *context)
 
        map_size= tracks_map_size(context->tracks_map);
 
-       /* nothing to track, avoid unneeded frames reading to save time and memory */
+       /* nothing to track, avoid reading unneeded frames to save time and memory */
        if(!map_size)
                return 0;