Hi Robert,
The 3d engine is called by an other application, frame by frame, so the
application call a personal method to close a View (we have one or more
Viewer). There is a map to get the viewer pointer associated to the Opengl
Context it has, which allow us modifying a viewer or an other one. So when
we decide to close a viewer, I set the viewer as done, verify the thread are
stopped, and I remove it from our viewer map. This implicitly call the
viewer destructor, then causes the crash.
The map is a ref_ptr map and the viewer before being deleted only has a ref
count of 1, so I can erase the map element, which call the viewer destructor
causing the crash.
Sorry for the lack of explanation, I hope this is better.
Thanks.
Regards,
Vincent.
2009/6/25 Robert Osfield <[email protected]>
> Hi Vincent,
>
> What exactly do you mean by "when I use the other way and call the
> destructor (I clear the viewer map I get) there is a crash in", as
> these seems odd, you never call the destructor, all you can do is call
> delete, but in the case of the Viewer class you should never be
> calling delete yourself, rather leave it to C++ to clean up in the
> case of creating the Viewer in local scope on the stack, or using a
> ref_ptr<> when you manage the Viewer on the heap.
>
> Robert.
>
> On Thu, Jun 25, 2009 at 12:30 PM, Vincent
> Bourdier<[email protected]> wrote:
> > Hi all,
> >
> > I have a crash on a composite viewer destructor, and I do not see
> anything
> > strange or wrong in my code.
> >
> > My viewer is managed as an external lib, and the frame() call are done by
> a
> > method, like the close() call to finish a viewer.
> >
> > So, if I use the viewer->run() there is no problem, but when I use the
> other
> > way and call the destructor (I clear the viewer map I get) there is a
> crash
> > in
> >
> > GLObjects.cpp :
> >
> > void osg::flushAllDeletedGLObjects(unsigned int contextID)
> > {
> > double currentTime = DBL_MAX;
> > double availableTime = DBL_MAX;
> >
> >
> osg::BufferObject::flushDeletedBufferObjects(contextID,currentTime,availableTime);
> > osg::Drawable::flushAllDeletedDisplayLists(contextID);
> >
> >
> osg::FragmentProgram::flushDeletedFragmentProgramObjects(contextID,currentTime,availableTime);
> >
> >
> osg::FrameBufferObject::flushDeletedFrameBufferObjects(contextID,currentTime,availableTime);
> >
> >
> //osg::Program::flushDeletedGlPrograms(contextID,currentTime,availableTime);
> > //CRASH Here
> >
> >
> osg::RenderBuffer::flushDeletedRenderBuffers(contextID,currentTime,availableTime);
> >
> >
> //osg::Shader::flushDeletedGlShaders(contextID,currentTime,availableTime);
> > //CRASH Here
> > osg::Texture::flushAllDeletedTextureObjects(contextID);
> >
> >
> osg::VertexProgram::flushDeletedVertexProgramObjects(contextID,currentTime,availableTime);
> >
> >
> osg::OcclusionQueryNode::flushDeletedQueryObjects(contextID,currentTime,availableTime);
> >
> > }
> >
> > in DEBUG_INFO I get :
> > ...
> > Releasing GL objects for Camera=05EAE0C8 _state=05EB7050
> > Closing still viable window 0 _state->getContextID()=0
> > Doing Flush
> > GraphicsContext::setWindowingSystemInterface() 00000000 05DE9198
> >
> > Any idea ? suggestion ?
> >
> > Thanks a lot.
> >
> > Regards,
> > Vincent.
> >
> > _______________________________________________
> > osg-users mailing list
> > [email protected]
> >
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >
> >
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org