[Bf-blender-cvs] [825892a] master: Fix T45017: Crash when running 'track markers' operator with no clip loaded.

Bastien Montagne noreply at git.blender.org
Wed Jun 10 17:24:53 CEST 2015


Commit: 825892ae7aab423124ee39524ca0278e8ba8633b
Author: Bastien Montagne
Date:   Wed Jun 10 17:22:49 2015 +0200
Branches: master
https://developer.blender.org/rB825892ae7aab423124ee39524ca0278e8ba8633b

Fix T45017: Crash when running 'track markers' operator with no clip loaded.

CLIP_OT_track_markers was missing a poll callback.

===================================================================

M	source/blender/editors/space_clip/clip_editor.c
M	source/blender/editors/space_clip/tracking_ops.c

===================================================================

diff --git a/source/blender/editors/space_clip/clip_editor.c b/source/blender/editors/space_clip/clip_editor.c
index d67c03f..0dc4143 100644
--- a/source/blender/editors/space_clip/clip_editor.c
+++ b/source/blender/editors/space_clip/clip_editor.c
@@ -219,7 +219,10 @@ int ED_space_clip_get_clip_frame_number(SpaceClip *sc)
 {
 	MovieClip *clip = ED_space_clip_get_clip(sc);
 
-	return BKE_movieclip_remap_scene_to_clip_frame(clip, sc->user.framenr);
+	if (clip) {
+		return BKE_movieclip_remap_scene_to_clip_frame(clip, sc->user.framenr);
+	}
+	return 0;
 }
 
 ImBuf *ED_space_clip_get_buffer(SpaceClip *sc)
diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c
index 538c1a4..5e64d87 100644
--- a/source/blender/editors/space_clip/tracking_ops.c
+++ b/source/blender/editors/space_clip/tracking_ops.c
@@ -1426,6 +1426,7 @@ static int track_markers_invoke(bContext *C, wmOperator *op, const wmEvent *UNUS
 	}
 
 	clip = ED_space_clip_get_clip(sc);
+	BLI_assert(clip);
 	framenr = ED_space_clip_get_clip_frame_number(sc);
 
 	if (WM_jobs_test(CTX_wm_manager(C), sa, WM_JOB_TYPE_ANY)) {
@@ -1504,6 +1505,7 @@ void CLIP_OT_track_markers(wmOperatorType *ot)
 	ot->exec = track_markers_exec;
 	ot->invoke = track_markers_invoke;
 	ot->modal = track_markers_modal;
+	ot->poll = ED_space_clip_tracking_poll;
 
 	/* flags */
 	ot->flag = OPTYPE_UNDO;




More information about the Bf-blender-cvs mailing list