I was using the Windows close button in the title bar or alt-f4.

It does not happen with osgwindow because (as far as I can see), it closes down via a different route. In that example, osgwindow gets a WM_CLOSE message which is handled by the event handler as a CLOSE_WINDOW message and everything seems to shut down in an orderly manner.

For the MFC example, OSG is terminated with a WM_DESTROY message. The WM_CLOSE message is handled by the parent frame window and OSG never sees it.

Cory

Robert Osfield wrote:
Hi Cory,

How did you close the application?  Pressing escape or closing it via
the window close button?

Does the problem happen with other examples, such as osgwindow?

Robert.

On Fri, Jun 26, 2009 at 9:28 PM, Cory Riddell<[email protected]> wrote:
  
In another message thread I've been talking about a threading problem in
my app. I just figured out how to reproduce it with one of the samples,
so I thought I would post that here in hopes that somebody else would
have an idea on how to fix this.

I think it's a shutdown sequence race. To reproduce the problem, start
the osgviewerMFC sample app. Load the cow, turn on stats (hit 's') then
close the app. Sometimes you will get a crash. To make the crash happen
all the time, add a Sleep() call to the start of the WM_DESTROY handler
in MFC_OSG_MDIView.cpp:
    
void CMFC_OSG_MDIView::OnDestroy()
{
    Sleep(1200);
    if(mOSG != 0) delete mOSG;

    WaitForSingleObject(mThreadHandle, 1000);

    CView::OnDestroy();
}
      
As far as I can see, when GraphicsWindowWin32 process the WM_DESTROY
message, it sets _valid to false for the context. This prevents
~Viewer() from closing the context. This leaves a thread running and
that generates an access violation because it tires to use elements that
have been deleted. If the Viewer destructor is processed first, then
everything is ok.

This is related to the presence of a slave camera (that's why you have
to turn the stats display on).

Any ideas?

Thanks,
Cory
_______________________________________________
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

Reply via email to