Re: [osg-users] Crash in Viewer Destructor

2009-07-01 Thread bert . haselden
U
Sent via BlackBerry from T-Mobile

-Original Message-
From: Robert Osfield robert.osfi...@gmail.com

Date: Thu, 25 Jun 2009 17:21:36 
To: OpenSceneGraph Usersosg-users@lists.openscenegraph.org
Subject: Re: [osg-users] Crash in Viewer Destructor


On Thu, Jun 25, 2009 at 5:17 PM, Vincent
Bourdiervincent.bourd...@gmail.com wrote:
 Hi Robert,

 This is not possible for me to reproduce the behavior on an example, too
 much external things are required.

There isn't much we can do then.

 But I have some idea : there is some shaders running, and they are not
 removed before the viewer have to stop ... and the
 crash is in the Program and Shader flush ... does it sounds like a reason
 for crash ?
 I'll have a look.

It sounds like the graphics thread is still running, and the crash
relating to the shaders is an symptom of this, it isn't the cause
though.  You need to look thoroughly at the whether the threads are
still running or not.  Try changing the viewer threading model to
explore this.

Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Crash in Viewer Destructor

2009-06-26 Thread Vincent Bourdier
Hi Robert,

If I remove the shaders of my scene, the crash disappear.
Now, I'm looking at a way to stop the Shaders before ending the viewer.

When I need to delete the view, I do :
stopThreading();
setDone(true);
map-erase(viewer);

I though the stopThreading() call would do the work for me concerning the
shaders...

Is there any way to do it ?

Thanks.

Regards,
Vincent.

2009/6/25 Robert Osfield robert.osfi...@gmail.com

 On Thu, Jun 25, 2009 at 5:17 PM, Vincent
 Bourdiervincent.bourd...@gmail.com wrote:
  Hi Robert,
 
  This is not possible for me to reproduce the behavior on an example, too
  much external things are required.

 There isn't much we can do then.

  But I have some idea : there is some shaders running, and they are not
  removed before the viewer have to stop ... and the
  crash is in the Program and Shader flush ... does it sounds like a reason
  for crash ?
  I'll have a look.

 It sounds like the graphics thread is still running, and the crash
 relating to the shaders is an symptom of this, it isn't the cause
 though.  You need to look thoroughly at the whether the threads are
 still running or not.  Try changing the viewer threading model to
 explore this.

 Robert.
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Crash in Viewer Destructor

2009-06-26 Thread Robert Osfield
HI Vincent,

There really isn't much I can do beyond what I've already said.  The
stopThreading() should stop the threads, since I don't have the code
that reproduces the problem I can do nothing more.

Robert.

On Fri, Jun 26, 2009 at 7:56 AM, Vincent
Bourdiervincent.bourd...@gmail.com wrote:
 Hi Robert,

 If I remove the shaders of my scene, the crash disappear.
 Now, I'm looking at a way to stop the Shaders before ending the viewer.

 When I need to delete the view, I do :
 stopThreading();
 setDone(true);
 map-erase(viewer);

 I though the stopThreading() call would do the work for me concerning the
 shaders...

 Is there any way to do it ?

 Thanks.

 Regards,
     Vincent.

 2009/6/25 Robert Osfield robert.osfi...@gmail.com

 On Thu, Jun 25, 2009 at 5:17 PM, Vincent
 Bourdiervincent.bourd...@gmail.com wrote:
  Hi Robert,
 
  This is not possible for me to reproduce the behavior on an example, too
  much external things are required.

 There isn't much we can do then.

  But I have some idea : there is some shaders running, and they are not
  removed before the viewer have to stop ... and the
  crash is in the Program and Shader flush ... does it sounds like a
  reason
  for crash ?
  I'll have a look.

 It sounds like the graphics thread is still running, and the crash
 relating to the shaders is an symptom of this, it isn't the cause
 though.  You need to look thoroughly at the whether the threads are
 still running or not.  Try changing the viewer threading model to
 explore this.

 Robert.
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Crash in Viewer Destructor

2009-06-25 Thread Vincent Bourdier
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() 05DE9198

Any idea ? suggestion ?

Thanks a lot.

Regards,
   Vincent.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Crash in Viewer Destructor

2009-06-25 Thread Robert Osfield
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
Bourdiervincent.bourd...@gmail.com 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()     05DE9198

 Any idea ? suggestion ?

 Thanks a lot.

 Regards,
    Vincent.

 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Crash in Viewer Destructor

2009-06-25 Thread Vincent Bourdier
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 robert.osfi...@gmail.com

 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
 Bourdiervincent.bourd...@gmail.com 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() 05DE9198
 
  Any idea ? suggestion ?
 
  Thanks a lot.
 
  Regards,
 Vincent.
 
  ___
  osg-users mailing list
  osg-users@lists.openscenegraph.org
 
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
 
 
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Crash in Viewer Destructor

2009-06-25 Thread Robert Osfield
Hi Vincent,

It does sound like the destruction of threads and wait for them to
complete it not functioning correctly somehow.  I'm afraid this isn't
something one can debug remotely, could you please modify one of the
OSG examples to behave in similar way to your app so that it recreates
the bug in way that others can test it out first hand.

Robert.

On Thu, Jun 25, 2009 at 2:40 PM, Vincent
Bourdiervincent.bourd...@gmail.com wrote:
 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 robert.osfi...@gmail.com

 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
 Bourdiervincent.bourd...@gmail.com 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()     05DE9198
 
  Any idea ? suggestion ?
 
  Thanks a lot.
 
  Regards,
     Vincent.
 
  ___
  osg-users mailing list
  osg-users@lists.openscenegraph.org
 
  http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
 
 
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Crash in Viewer Destructor

2009-06-25 Thread Vincent Bourdier
Hi Robert,

This is not possible for me to reproduce the behavior on an example, too
much external things are required.

But I have some idea : there is some shaders running, and they are not
removed before the viewer have to stop ... and the
crash is in the Program and Shader flush ... does it sounds like a reason
for crash ?
I'll have a look.

Thanks for your help.

Regards,

Vincent

2009/6/25 Robert Osfield robert.osfi...@gmail.com

 Hi Vincent,

 It does sound like the destruction of threads and wait for them to
 complete it not functioning correctly somehow.  I'm afraid this isn't
 something one can debug remotely, could you please modify one of the
 OSG examples to behave in similar way to your app so that it recreates
 the bug in way that others can test it out first hand.

 Robert.

 On Thu, Jun 25, 2009 at 2:40 PM, Vincent
 Bourdiervincent.bourd...@gmail.com wrote:
  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 robert.osfi...@gmail.com
 
  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
  Bourdiervincent.bourd...@gmail.com 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() 05DE9198
  
   Any idea ? suggestion ?
  
   Thanks a lot.
  
   Regards,
  Vincent.
  
   ___
   osg-users mailing list
   osg-users@lists.openscenegraph.org
  
  
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
  
  
  ___
  osg-users mailing list
  osg-users@lists.openscenegraph.org
 
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
 
 
  ___
  osg-users mailing list
  osg-users@lists.openscenegraph.org
 
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
 
 
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Crash in Viewer Destructor

2009-06-25 Thread Robert Osfield
On Thu, Jun 25, 2009 at 5:17 PM, Vincent
Bourdiervincent.bourd...@gmail.com wrote:
 Hi Robert,

 This is not possible for me to reproduce the behavior on an example, too
 much external things are required.

There isn't much we can do then.

 But I have some idea : there is some shaders running, and they are not
 removed before the viewer have to stop ... and the
 crash is in the Program and Shader flush ... does it sounds like a reason
 for crash ?
 I'll have a look.

It sounds like the graphics thread is still running, and the crash
relating to the shaders is an symptom of this, it isn't the cause
though.  You need to look thoroughly at the whether the threads are
still running or not.  Try changing the viewer threading model to
explore this.

Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org