Thanks for making the changes and testing them, changes now merged and
submitted to svn/trunk and OSG-2.8 branch.

On Wed, Jul 8, 2009 at 4:11 PM, Cory Riddell<[email protected]> wrote:
> Hi Robert,
>
> I've been running with your suggested changes for a few days now and it
> has been working perfectly. I'm still not entirely clear why adding a
> slave/subgraph causes the problem.
>
> Before applying your change, the app would always crash in
> GraphicsContext::runOperations(). Here's the relevant portion:
>
> void GraphicsContext::runOperations()
> {
>  // sort the cameras into order
>  typedef std::vector<Camera*> CameraVector;
>  CameraVector camerasCopy;
>  std::copy(_cameras.begin(), _cameras.end(),
> std::back_inserter(camerasCopy));
>  std::sort(camerasCopy.begin(), camerasCopy.end(),
> CameraRenderOrderSortOp());
>
>  for(CameraVector::iterator itr = camerasCopy.begin();
>      itr != camerasCopy.end();
>      ++itr)
>  {
>    osg::Camera* camera = *itr;
>    if (camera->getRenderer()) (*(camera->getRenderer()))(this);
>  }
>  ...
>
>
> It makes a copy of all the camera pointers, then iterates over the
> copied pointers. At shutdown time, the cameras were being deleted after
> the copy of the pointer had been already been made and the world would
> crash when the (now) invalid pointer was dereferenced.
>
> Your change kills the thread before deleting the camera, so the problem
> goes away. I've attached the modified file. Thanks so much for your help
> on this.
>
> Cory
>
>
>
> _______________________________________________
> 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

Reply via email to