David & Robert,
I think I found the race that is giving me problems.
When I close my app, sometimes GraphicsWindowWin32 gets the WM_DESTROY
message before I call viewer->setDone(). In these cases, the
GraphicsWindowWin32 gets destroyed (marked invalid), but I think the
graphics thread remains (not certain of this). So, the context doesn't
get closed by the Viewer destructor.
I think I should be able to get around the problem by either manually
closing the graphics context or by carefully orchestrating the shutdown
sequence.
Cory
Cory Riddell wrote:
David,
Thanks for the information. It sounds like there might actually be a
problem here. Rather than code around it, I'm going to keep poking
around to see if I can figure out what's going on. It's nice to have a
plan B though, so thank you for the advice.
Right now it looks like the Viewer::getContexts(contexts, true) method
is being called from ViewerBase::stopThreading(). The thread that is
still running (GraphicsContext which I believe was started when I
called realize()) isn't marked as valid and thus is not reported by
getContexts(). Now I'm trying to figure out how that thread can still
be running and not be valid.
One thing that is slightly strange about my scene graph is that I have
a slave camera rendering a subgraph for the background. Did you have
more than one camera?
Cory
David Spilling wrote:
Cory,
FWIW, I do what you do : I have an OpenThreads::Thread class which
_has_ a viewer. The parent application starts this thread up, and lets
it get on with viewer creation, frame dispatch, viewer deletion and so
on.
I had very similar problems to you a while ago (> 1 year? ) when I
originally set this up.
>...assuming that it is ok to call
viewer->setDone() from a different thread?
This sounds familiar. I only call viewer->setDone from within the
thread that owns it. (The thread that owns the viewer has a "Stop"
method, which calls setDone).
This works for me.
Hope that helps,
David
_______________________________________________
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