Cycles: Fix memory leak with session

We didn't check for sync object being already allocated.
In fact, we simply need to use proper function to free
session.
This commit is contained in:
Sergey Sharybin
2018-06-25 17:01:24 +02:00
parent c2110213ca
commit 7cd86cd1fe

View File

@@ -54,6 +54,7 @@ BlenderSession::BlenderSession(BL::RenderEngine& b_engine,
BL::BlendData& b_data,
bool preview_osl)
: session(NULL),
sync(NULL),
b_engine(b_engine),
b_userpref(b_userpref),
b_data(b_data),
@@ -81,6 +82,7 @@ BlenderSession::BlenderSession(BL::RenderEngine& b_engine,
BL::RegionView3D& b_rv3d,
int width, int height)
: session(NULL),
sync(NULL),
b_engine(b_engine),
b_userpref(b_userpref),
b_data(b_data),
@@ -209,11 +211,8 @@ void BlenderSession::reset_session(BL::BlendData& b_data, BL::Depsgraph& b_depsg
/* if scene or session parameters changed, it's easier to simply re-create
* them rather than trying to distinguish which settings need to be updated
*/
delete session;
free_session();
create_session();
return;
}