diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-07-13 00:31:30 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-07-13 00:31:30 +0400 |
commit | 32586e6805dea4af46955a86b102989992b7e24c (patch) | |
tree | e58a81521cf473981601a7bc3c5da3c12bf14cea /source | |
parent | 99e97afbe398fe44ceae6a85039a80c32b5a4606 (diff) |
Fix #35470: crash rendering from the terminal in some cases due to render info
text threading issue.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/render/render_internal.c | 7 | ||||
-rw-r--r-- | source/blender/render/extern/include/RE_engine.h | 2 | ||||
-rw-r--r-- | source/blender/render/intern/source/external_engine.c | 14 |
3 files changed, 8 insertions, 15 deletions
diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c index abc91b4329d..b9653da47e6 100644 --- a/source/blender/editors/render/render_internal.c +++ b/source/blender/editors/render/render_internal.c @@ -650,7 +650,7 @@ static int screen_render_invoke(bContext *C, wmOperator *op, const wmEvent *even rj->lay = v3d->lay; rj->v3d_override = true; } - else if (camera_override != scene->camera) + else if (camera_override && camera_override != scene->camera) rj->v3d_override = true; if (v3d->localvd) @@ -1060,9 +1060,8 @@ static void render_view3d_do(RenderEngine *engine, const bContext *C) rp->bmain = CTX_data_main(C); copy_m4_m4(rp->viewmat, rp->rv3d->viewmat); - /* dont alloc in threads */ - if (engine->text == NULL) - engine->text = MEM_callocN(IMA_MAX_RENDER_TEXT, "rendertext"); + /* clear info text */ + engine->text[0] = '\0'; /* setup job */ WM_jobs_customdata_set(wm_job, rp, render_view3d_free); diff --git a/source/blender/render/extern/include/RE_engine.h b/source/blender/render/extern/include/RE_engine.h index d8858d9a114..7bec3eb234d 100644 --- a/source/blender/render/extern/include/RE_engine.h +++ b/source/blender/render/extern/include/RE_engine.h @@ -107,7 +107,7 @@ typedef struct RenderEngine { struct Render *re; ListBase fullresult; - char *text; + char text[512]; /* IMA_MAX_RENDER_TEXT */ int resolution_x, resolution_y; diff --git a/source/blender/render/intern/source/external_engine.c b/source/blender/render/intern/source/external_engine.c index 6e98d8b82ab..616dd623b94 100644 --- a/source/blender/render/intern/source/external_engine.c +++ b/source/blender/render/intern/source/external_engine.c @@ -158,9 +158,6 @@ void RE_engine_free(RenderEngine *engine) BLI_end_threaded_malloc(); } - if (engine->text) - MEM_freeN(engine->text); - MEM_freeN(engine); } @@ -307,17 +304,14 @@ void RE_engine_update_stats(RenderEngine *engine, const char *stats, const char } /* set engine text */ - if (engine->text) { - MEM_freeN(engine->text); - engine->text = NULL; - } + engine->text[0] = '\0'; if (stats && stats[0] && info && info[0]) - engine->text = BLI_sprintfN("%s | %s", stats, info); + BLI_snprintf(engine->text, sizeof(engine->text), "%s | %s", stats, info); else if (info && info[0]) - engine->text = BLI_strdup(info); + BLI_strncpy(engine->text, info, sizeof(engine->text)); else if (stats && stats[0]) - engine->text = BLI_strdup(stats); + BLI_strncpy(engine->text, info, sizeof(engine->text)); } void RE_engine_update_progress(RenderEngine *engine, float progress) |