Hi Sylvain, Thanks for the files and explanation. I have just done a review and they in effect force the multi-threaded fallback of forcing the updates to only happen in the update thread. If this is what we need to do then the flag becomes redundant and we might as well just implement the multi-threaded path.
However, I'm reluctant to do this as yet I have haven't established why the _writeBufferMutex is failing and I don't have an example that reproduces the problem to work from. Getting to the bottom of the actual problem is what I'm after rather than coming up with a possible fix, the fix could just as easily be incomplete and the code will fail later in other ways. Could you explain how you are creating your TerrainTile's and how you are going about adding them to the scene graph? There must be something different that you are doing compared to what happens when the OSG loads TerrainTile via the DatabasePager. Robert. On 24 April 2014 19:23, Sylvain Comtois <[email protected]> wrote: > Hi Robert, > > I place the three files in attachment. > > The modification consist to replace the assumeMultiThreaded parameter of > the GeometryTechnique::init, TerrainTechnique::init and TerrainTile::init to > true. > > We take no chance and we modify all call to the init function. > > The bug occur in the GeometryTechnique::init in the following section: > > if (!_currentBufferData || !assumeMultiThreaded) > { > // no currentBufferData so we must be the first init to be applied > _currentBufferData = buffer; > } > > In multithread the first thread create a buffer and assign it to the > _currentBufferData. The second thread follow the first one and also create a > buffer and assign it to the _currentBufferData and at this time the first > buffer is delete (refptr) but the first thread is still traversing the > _currentBufferData what cause the crash. > > I still not understand why the lock(_writeBufferMutex) do not prevent the > second thread to reach this point. > > I don't made a small program to reproduce the bug right now. But we must > be in multi-thread (CullDrawThreadPerContext) rendering. We have four camera, > one master and 3 slaves with one context per camera. We add the OSGTerrain > between two calls of the viewer::frame() function. > > Cheers, > Sylvain > > ------------------ > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=59147#59147 > > > > > _______________________________________________ > osg-submissions mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org > _______________________________________________ osg-submissions mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
