[Bf-blender-cvs] [592a3d7b477] master: Tracking: Perform tracking and solving from a locked interface

Sergey Sharybin noreply at git.blender.org
Fri Sep 13 12:08:34 CEST 2019


Commit: 592a3d7b4771c8d329d586e8bfa776b25666921b
Author: Sergey Sharybin
Date:   Fri Sep 13 11:48:22 2019 +0200
Branches: master
https://developer.blender.org/rB592a3d7b4771c8d329d586e8bfa776b25666921b

Tracking: Perform tracking and solving from a locked interface

Solves stability issues with possibly doing destructive changes to the
tracking setup. Locking interface is the simplest and most reliable way
to avoid crashes.

It is still possible to run non-destructive changes such as clip view
navigation. More operations can be marked as safe if needed.

Fixes T67012: Software closes when a processing marker is deleted

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

M	source/blender/editors/space_clip/tracking_ops_solve.c
M	source/blender/editors/space_clip/tracking_ops_track.c

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

diff --git a/source/blender/editors/space_clip/tracking_ops_solve.c b/source/blender/editors/space_clip/tracking_ops_solve.c
index 96b00ec5463..1d2fc239a89 100644
--- a/source/blender/editors/space_clip/tracking_ops_solve.c
+++ b/source/blender/editors/space_clip/tracking_ops_solve.c
@@ -50,6 +50,7 @@
 /********************** solve camera operator *********************/
 
 typedef struct {
+  struct wmWindowManager *wm;
   Scene *scene;
   MovieClip *clip;
   MovieClipUser user;
@@ -78,6 +79,7 @@ static bool solve_camera_initjob(
   /* Could fail if footage uses images with different sizes. */
   BKE_movieclip_get_size(clip, &sc->user, &width, &height);
 
+  scj->wm = CTX_wm_manager(C);
   scj->clip = clip;
   scj->scene = scene;
   scj->reports = op->reports;
@@ -88,6 +90,8 @@ static bool solve_camera_initjob(
 
   tracking->stats = MEM_callocN(sizeof(MovieTrackingStats), "solve camera stats");
 
+  WM_set_locked_interface(scj->wm, true);
+
   return true;
 }
 
@@ -114,6 +118,8 @@ static void solve_camera_freejob(void *scv)
   MovieClip *clip = scj->clip;
   int solved;
 
+  WM_set_locked_interface(scj->wm, false);
+
   if (!scj->context) {
     /* job weren't fully initialized due to some error */
     MEM_freeN(scj);
diff --git a/source/blender/editors/space_clip/tracking_ops_track.c b/source/blender/editors/space_clip/tracking_ops_track.c
index 4d3281c6cf9..adbb3e30850 100644
--- a/source/blender/editors/space_clip/tracking_ops_track.c
+++ b/source/blender/editors/space_clip/tracking_ops_track.c
@@ -59,6 +59,7 @@ typedef struct TrackMarkersJob {
   float delay;                      /* Delay in milliseconds to allow
                                      * tracking at fixed FPS */
 
+  struct wmWindowManager *wm;
   struct Main *main;
   struct Scene *scene;
   struct bScreen *screen;
@@ -202,7 +203,15 @@ static bool track_markers_initjob(bContext *C, TrackMarkersJob *tmj, bool backwa
   tmj->main = CTX_data_main(C);
   tmj->screen = CTX_wm_screen(C);
 
-  return track_markers_check_direction(backwards, tmj->sfra, tmj->efra);
+  tmj->wm = CTX_wm_manager(C);
+
+  if (!track_markers_check_direction(backwards, tmj->sfra, tmj->efra)) {
+    return false;
+  }
+
+  WM_set_locked_interface(tmj->wm, true);
+
+  return true;
 }
 
 static void track_markers_startjob(void *tmv, short *stop, short *do_update, float *progress)
@@ -281,6 +290,7 @@ static void track_markers_freejob(void *tmv)
 {
   TrackMarkersJob *tmj = (TrackMarkersJob *)tmv;
   tmj->clip->tracking_context = NULL;
+  WM_set_locked_interface(tmj->wm, false);
   BKE_autotrack_context_free(tmj->context);
   MEM_freeN(tmj);
 }



More information about the Bf-blender-cvs mailing list