[Bf-blender-cvs] [8ab6ef30ab2] blender-v2.81-release: Fix T68018: Crash on building movie proxy

Richard Antalik noreply at git.blender.org
Sun Nov 3 05:51:23 CET 2019


Commit: 8ab6ef30ab28e6c73fc9309c0b21ddbc1cd3afc9
Author: Richard Antalik
Date:   Sat Nov 2 20:29:59 2019 -0700
Branches: blender-v2.81-release
https://developer.blender.org/rB8ab6ef30ab28e6c73fc9309c0b21ddbc1cd3afc9

Fix T68018: Crash on building movie proxy

Skip building proxy if directory can not be created.

Crash happens, when setting custom dir to location of source file itself.
This results in attempt to create directory with the same name as source file.

Differential Revision: https://developer.blender.org/D6148
Reviewed By: sergey

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

M	source/blender/blenkernel/BKE_sequencer.h
M	source/blender/blenkernel/intern/sequencer.c
M	source/blender/editors/space_sequencer/sequencer_edit.c
M	source/blender/imbuf/intern/indexer.c

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

diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h
index a5b223a73f2..c1bb60737ff 100644
--- a/source/blender/blenkernel/BKE_sequencer.h
+++ b/source/blender/blenkernel/BKE_sequencer.h
@@ -289,7 +289,7 @@ bool BKE_sequencer_input_have_to_preprocess(const SeqRenderData *context,
                                             struct Sequence *seq,
                                             float cfra);
 
-void BKE_sequencer_proxy_rebuild_context(struct Main *bmain,
+bool BKE_sequencer_proxy_rebuild_context(struct Main *bmain,
                                          struct Depsgraph *depsgraph,
                                          struct Scene *scene,
                                          struct Sequence *seq,
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index 26dd9aab511..9f7dc8444ed 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -2093,7 +2093,7 @@ static int seq_proxy_context_count(Sequence *seq, Scene *scene)
   return num_views;
 }
 
-void BKE_sequencer_proxy_rebuild_context(Main *bmain,
+bool BKE_sequencer_proxy_rebuild_context(Main *bmain,
                                          Depsgraph *depsgraph,
                                          Scene *scene,
                                          Sequence *seq,
@@ -2138,9 +2138,6 @@ void BKE_sequencer_proxy_rebuild_context(Main *bmain,
 
     context->view_id = i; /* only for images */
 
-    link = BLI_genericNodeN(context);
-    BLI_addtail(queue, link);
-
     if (nseq->type == SEQ_TYPE_MOVIE) {
       StripAnim *sanim;
 
@@ -2155,8 +2152,16 @@ void BKE_sequencer_proxy_rebuild_context(Main *bmain,
                                                                 context->overwrite,
                                                                 file_list);
       }
+      if (!context->index_context) {
+        MEM_freeN(context);
+        return false;
+      }
     }
+
+    link = BLI_genericNodeN(context);
+    BLI_addtail(queue, link);
   }
+  return true;
 }
 
 void BKE_sequencer_proxy_rebuild(SeqIndexBuildContext *context,
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index 865dfb45278..ca1c55b80eb 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -177,7 +177,7 @@ static void proxy_endjob(void *pjv)
   WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, pj->scene);
 }
 
-static void seq_proxy_build_job(const bContext *C)
+static void seq_proxy_build_job(const bContext *C, ReportList *reports)
 {
   wmJob *wm_job;
   ProxyJob *pj;
@@ -216,8 +216,12 @@ static void seq_proxy_build_job(const bContext *C)
   file_list = BLI_gset_new(BLI_ghashutil_strhash_p, BLI_ghashutil_strcmp, "file list");
   SEQP_BEGIN (ed, seq) {
     if ((seq->flag & SELECT)) {
-      BKE_sequencer_proxy_rebuild_context(
+      bool success = BKE_sequencer_proxy_rebuild_context(
           pj->main, pj->depsgraph, pj->scene, seq, file_list, &pj->queue);
+      if (!success) {
+
+        BKE_reportf(reports, RPT_ERROR, "Could not build proxy for strip %s", &seq->name);
+      }
     }
   }
   SEQ_END;
@@ -3608,10 +3612,10 @@ void SEQUENCER_OT_view_ghost_border(wmOperatorType *ot)
 /* rebuild_proxy operator */
 
 static int sequencer_rebuild_proxy_invoke(bContext *C,
-                                          wmOperator *UNUSED(op),
+                                          wmOperator *op,
                                           const wmEvent *UNUSED(event))
 {
-  seq_proxy_build_job(C);
+  seq_proxy_build_job(C, op->reports);
 
   return OPERATOR_FINISHED;
 }
diff --git a/source/blender/imbuf/intern/indexer.c b/source/blender/imbuf/intern/indexer.c
index 97a0cc85301..46095b7eedc 100644
--- a/source/blender/imbuf/intern/indexer.c
+++ b/source/blender/imbuf/intern/indexer.c
@@ -366,7 +366,7 @@ void IMB_anim_get_fname(struct anim *anim, char *file, int size)
   BLI_strncpy(file, fname, size);
 }
 
-static void get_proxy_filename(struct anim *anim,
+static bool get_proxy_filename(struct anim *anim,
                                IMB_Proxy_Size preview_size,
                                char *fname,
                                bool temp)
@@ -393,7 +393,12 @@ static void get_proxy_filename(struct anim *anim,
 
   get_index_dir(anim, index_dir, sizeof(index_dir));
 
+  if (BLI_path_ncmp(anim->name, index_dir, FILE_MAXDIR) == 0) {
+    return false;
+  }
+
   BLI_join_dirfile(fname, FILE_MAXFILE + FILE_MAXDIR, index_dir, proxy_name);
+  return true;
 }
 
 static void get_tc_filename(struct anim *anim, IMB_Timecode_Type tc, char *fname)
@@ -1154,8 +1159,9 @@ IndexBuildContext *IMB_anim_index_rebuild_context(struct anim *anim,
       IMB_Proxy_Size proxy_size = proxy_sizes[i];
       if (proxy_size & proxy_sizes_to_build) {
         char filename[FILE_MAX];
-        get_proxy_filename(anim, proxy_size, filename, false);
-
+        if (get_proxy_filename(anim, proxy_size, filename, false) == false) {
+          return NULL;
+        }
         void **filename_key_p;
         if (!BLI_gset_ensure_p_ex(file_list, filename, &filename_key_p)) {
           *filename_key_p = BLI_strdup(filename);
@@ -1176,7 +1182,9 @@ IndexBuildContext *IMB_anim_index_rebuild_context(struct anim *anim,
         IMB_Proxy_Size proxy_size = proxy_sizes[i];
         if (proxy_size & built_proxies) {
           char filename[FILE_MAX];
-          get_proxy_filename(anim, proxy_size, filename, false);
+          if (get_proxy_filename(anim, proxy_size, filename, false) == false) {
+            return NULL;
+          }
           printf("Skipping proxy: %s\n", filename);
         }
       }



More information about the Bf-blender-cvs mailing list