diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-04-25 19:59:15 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-04-25 19:59:15 +0400 |
commit | 656213e6b2fb9adea9db8d7b08148301c0ffde76 (patch) | |
tree | 5f6d18f1199876ddfd491e4917343e42c152c18e | |
parent | 4a6de485c395928e6a63b4d85328f9b15ca92741 (diff) |
Fix freestyle crash due to freed memory access. The render data needs to be
freed first, and then the scene that it used.
-rw-r--r-- | source/blender/render/intern/source/convertblender.c | 6 | ||||
-rw-r--r-- | source/blender/render/intern/source/pipeline.c | 4 |
2 files changed, 7 insertions, 3 deletions
diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index 29d263d98c8..6accbe2e122 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -4862,12 +4862,14 @@ void RE_Database_Free(Render *re) if (re->wrld.aosphere) { MEM_freeN(re->wrld.aosphere); re->wrld.aosphere= NULL; - re->scene->world->aosphere= NULL; + if (re->scene) + re->scene->world->aosphere= NULL; } if (re->wrld.aotables) { MEM_freeN(re->wrld.aotables); re->wrld.aotables= NULL; - re->scene->world->aotables= NULL; + if (re->scene) + re->scene->world->aotables= NULL; } if (re->r.mode & R_RAYTRACE) free_render_qmcsampler(re); diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 8b74381acc2..e2d6633fffc 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -1676,14 +1676,16 @@ static void composite_freestyle_renders(Render *re, int sample) static void free_all_freestyle_renders(void) { Render *re1, *freestyle_render; + Scene *freestyle_scene; LinkData *link; for (re1= RenderGlobal.renderlist.first; re1; re1= re1->next) { for (link = (LinkData *)re1->freestyle_renders.first; link; link = link->next) { if (link->data) { freestyle_render = (Render *)link->data; - BKE_scene_unlink(&re1->freestyle_bmain, freestyle_render->scene, NULL); + freestyle_scene = freestyle_render->scene; RE_FreeRender(freestyle_render); + BKE_scene_unlink(&re1->freestyle_bmain, freestyle_scene, NULL); } } BLI_freelistN(&re1->freestyle_renders); |