Hi J.P, et. al, I have tracked down and fixed the setCursor() crash issue ;-)
The problem occurred because of subtle timing issue with the GraphicsContext::_threadOfLastMakeCurrent variable in the GraphicsContext::makeCurrent() and how this variable is used in the GraphicsWindowX11::getDisplayToUse(). What was happening is that viewer.realize() would create the windows and start the graphics thread on each window created and this thread would then do a makeCurrent() which onces complete would set the _threadOfLastMakeCurrent and then any getDisplayToUse() would then select the appropriate GraphicsWindow11::_eventDisplay or GraphicsWindow11::_display connection to the X server. The problem was that while the GrapohicsWindowX11::makeCurrentImplementation() was happening in the graphics thread, the main thread was doing a GraphicsWindow::setCursor() which in turn was calling getDisplayToUse() which returned _display rather than _eventDisplay as the makeCurrent() hadn't yet reset the _threadOfLastMakeCurrent, but using _display while another thread was doing a glxMakeCurrent isn't safe - and the crash occurred. To test it out I added a micro sleep into the main thread before the setCursor and this solved the issue if the sleep was long enough, the sleep didn't have to be too long - just long enough for the first makeCurrent() to do it's stuff, but it was easy to see how this would really timing sensitive. Once I confirmed it was a timing issue on the setting of _threadOfLastMakeCurrent it just became a simply tweak of GraphicsContext::makeCurrent() so it set this member varaible prior to calling makeCurrentImplementation(). With this change I could remove the micro sleep from the main thread and everything runs smoothly with the setCursor. I run 100 iterations of your test app and every time it came up correctly without any warnings :-) An svn update will get you this fix. Please let me know how you get on. Cheers, Robert. _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

