Fix for access freed scene when doing freestyle render
authorSergey Sharybin <sergey.vfx@gmail.com>
Thu, 18 Apr 2013 12:11:50 +0000 (12:11 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Thu, 18 Apr 2013 12:11:50 +0000 (12:11 +0000)
It's more like an ownership thing, but it's not so much
clear who actually is an owner of temporary scene, so
for now just ensure Render does not have link to it
after strokes are rendered.

There're also suspicious thing related on why separate
RE_free_database is needed for freestyle renders, but
that's also another story.

source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp

index 2d3fc20f92952c51dfa069cf54bdad4d8f565b83..31068c9c9d69e3163f583cfc08c6813065206228 100644 (file)
@@ -516,6 +516,11 @@ Render *BlenderStrokeRenderer::RenderScene(Render *re)
        Render *freestyle_render = RE_NewRender(freestyle_scene->id.name);
 
        RE_RenderFreestyleStrokes(freestyle_render, &_freestyle_bmain, freestyle_scene);
+
+       // rendering is done, scene would be freed in destructor,
+       // no need to store it's in render structure
+       freestyle_render->scene = NULL;
+
        return freestyle_render;
 }