Hi Brad,

I have same problem , but I can't resolve exactly. I only find kludge :) How
can you delete your class which contains "static render" function? If you
delete this class in destructor, it's normal getting error while closing
your application. I have tried almost a day to resolve this undefined
problem but couldn't.

And My solution is; deleting class before parent destructor calling. I mean,
you have renderClass and mainClass.
renderClass is which contains all rendering operation and static render
function.
You create renderClass object from mainClass and before closing application
you should delete renderClass out of mainClass destructor. And after that
you should let the mainClass destructor to run. I hope it will give you
smooth and error-free closing :)

Regards.

2009/2/12 Brad Huber <br...@procerusuav.com>

>  Hello,
>
>
>
> I am currently struggling with a problem that is manifesting in our MFC
> based app when using MultiThreading model with osg viewer.
>
>
>
> First of all when setting up the viewer in my class I used:
>
>
>
>
> mViewer->setThreadingModel(osgViewer::ViewerBase::ThreadingModel::AutomaticSelection);
>
> I also tried the default of not setting anything and the same problem
> happens.  If I set it to single threaded the problem disappears but
> obviously I don't want to run single threaded.
>
>
>
> Everything seems to run fine and then when I close the app my class
> destructor gets called.  The only code in the destructor is:
>
> mViewer->setDone(true);
>
> Sleep(1000);
>
> mViewer->stopThreading();
>
> Sleep(1000);
>
>
>
> Which is the same as what the example mfc code in the repository does.  The
> sleeps were only added to see if there was a race condition problem.
>
>
>
> However when I trace in to stopThreading I see that it returns immediately
> on the first line:
>
> if (!_threadsRunning) return;
>
>
>
> As a result it doesn't kill any threads or anything else BUT there are
> threads still running and they show up in the debugger.
>
>
>
> Then as the app continues to close I get:
>
>
>
>
>
> Which takes me to:
>
> win32mutex.cpp line 111
>
> int Mutex::lock() {
>
>     Win32MutexPrivateData *pd =
>
>         static_cast<Win32MutexPrivateData*>(_prvData);
>
>
>
> #ifdef USE_CRITICAL_SECTION
>
>
>
>     // Block until we can take this lock.
>
>     EnterCriticalSection( &(pd->_cs) );  ß exception here!
>
>
>
>     return 0;
>
>
>
> #else
>
> …
>
>
>
> This is OSG/Openthreads stuff!  I look up the call stack and see the
> osgViewer::Renderer.
>
>
>
>
>
> Does anyone have any insights about why this is going on?
>
>
>
> Thanks
>
> -Brad
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>


-- 
Ümit Uzun
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to