Skip to content

Commit

Permalink
Attempt to fix some crashes when adjusting material parameters
Browse files Browse the repository at this point in the history
Sometimes I'm getting crashes when changing material parameters or when switching tabs in the object properties panel in Blender.

This is an old issue and I tried several changes, but still happens. I don't know if this is caused by some thread/concurrency problem or by deleting objects already deleted for some reason.

Just in case I'm doing some changes to try to avoid this. I hope they help and don't cause any other problems like memory leaks, etc.
  • Loading branch information
DavidBluecame committed Jan 29, 2016
1 parent dc39640 commit a489e86
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/bindings/yafrayinterface.i
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,9 @@ public:

virtual void initTilesPasses(int totalViews, int numExtPasses)
{
PyGILState_STATE gstate;
gstate = PyGILState_Ensure();

tilesPasses.resize(totalViews);

for(size_t view = 0; view < tilesPasses.size(); ++view)
Expand All @@ -188,20 +191,27 @@ public:
tilesPasses.at(view)[idx]->resy = resy;
}
}

PyGILState_Release(gstate);
}

virtual ~pyOutput_t()
{
PyGILState_STATE gstate;
gstate = PyGILState_Ensure();

for(size_t view = 0; view < tilesPasses.size(); ++view)
{
for(size_t idx = 0; idx < tilesPasses.at(view).size(); ++idx)
{
delete [] tilesPasses.at(view)[idx]->mem;
if(tilesPasses.at(view)[idx]->mem) delete [] tilesPasses.at(view)[idx]->mem;
//Py_XDECREF(tilesPasses.at(view)[idx]);
}
tilesPasses.at(view).clear();
}
tilesPasses.clear();

PyGILState_Release(gstate);
}

virtual bool putPixel(int numView, int x, int y, const yafaray::renderPasses_t *renderPasses, const std::vector<yafaray::colorA_t> &colExtPasses, bool alpha = true)
Expand Down

0 comments on commit a489e86

Please sign in to comment.