diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-10-22 08:48:38 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-10-22 09:25:37 +0300 |
commit | c6d98fa8418d16f124a2866adf8a5848734241fd (patch) | |
tree | 912c465d1f2b635fa82a57ee5d4a82fa6a23e8bc /source/blender/render | |
parent | 85072eb4e91851177d7b5cd810f6ef3e033cae12 (diff) |
Fix T46565: Movie render crash w/o permissions
Rendering to a path that didn't have write permissions would crash.
Also fix error where `G.is_rendering` was left set when rendering failed.
Diffstat (limited to 'source/blender/render')
-rw-r--r-- | source/blender/render/intern/source/pipeline.c | 47 |
1 files changed, 30 insertions, 17 deletions
diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index d6ba97533b5..cdbcfbc2202 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -3486,6 +3486,18 @@ static void get_videos_dimensions(Render *re, RenderData *rd, size_t *r_width, s BKE_scene_multiview_videos_dimensions_get(rd, width, height, r_width, r_height); } +static void re_movie_free_all(Render *re, bMovieHandle *mh, size_t totvideos) +{ + size_t i; + + for (i = 0; i < totvideos; i++) { + mh->end_movie(re->movie_ctx_arr[i]); + mh->context_free(re->movie_ctx_arr[i]); + } + + MEM_SAFE_FREE(re->movie_ctx_arr); +} + /* saves images to disk */ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_override, unsigned int lay_override, int sfra, int efra, int tfra) @@ -3510,15 +3522,10 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri BKE_report(re->reports, RPT_ERROR, "Frame Server only support stereo output for multiview rendering"); return; } - - /* ugly global still... is to prevent renderwin events and signal subsurfs etc to make full resol */ - /* is also set by caller renderwin.c */ - G.is_rendering = true; - - re->flag |= R_ANIMATION; if (is_movie) { size_t i, width, height; + bool is_error = false; get_videos_dimensions(re, &rd, &width, &height); @@ -3535,11 +3542,25 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri re->movie_ctx_arr[i] = mh->context_create(); - if (!mh->start_movie(re->movie_ctx_arr[i], scene, &re->r, width, height, re->reports, false, suffix)) - G.is_break = true; + if (!mh->start_movie(re->movie_ctx_arr[i], scene, &re->r, width, height, re->reports, false, suffix)) { + is_error = true; + break; + } + } + + if (is_error) { + /* report is handled above */ + re_movie_free_all(re, mh, i + 1); + return; } } + /* ugly global still... is to prevent renderwin events and signal subsurfs etc to make full resol */ + /* is also set by caller renderwin.c */ + G.is_rendering = true; + + re->flag |= R_ANIMATION; + if (mh && mh->get_next_frame) { /* MULTIVIEW_TODO: * in case a new video format is added that implements get_next_frame multiview has to be addressed @@ -3723,15 +3744,7 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri /* end movie */ if (is_movie) { - size_t i; - for (i = 0; i < totvideos; i++) { - mh->end_movie(re->movie_ctx_arr[i]); - mh->context_free(re->movie_ctx_arr[i]); - } - - if (re->movie_ctx_arr) { - MEM_freeN(re->movie_ctx_arr); - } + re_movie_free_all(re, mh, totvideos); } if (totskipped && totrendered == 0) |