From Jannik Heller, "Fix for Qt4 multi-threaded crash. This patch adds the AA_X11InitThreads flag to the QApplication setup, meaning QT will call XInitThreads for us. This also bumps the required QT version to 4.8+, because the AA_X11InitThreads flag was introduced in that version. If that is not acceptable, we could add a QT_VERSION >= 0x040800 guard, or manually call XInitThreads() instead. Let me know what you think."
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14804 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
parent
63a3595aab
commit
6854d2968f
@ -105,6 +105,12 @@ int main( int argc, char** argv )
|
|||||||
while (arguments.read("--DrawThreadPerContext")) threadingModel = osgViewer::ViewerBase::DrawThreadPerContext;
|
while (arguments.read("--DrawThreadPerContext")) threadingModel = osgViewer::ViewerBase::DrawThreadPerContext;
|
||||||
while (arguments.read("--CullThreadPerCameraDrawThreadPerContext")) threadingModel = osgViewer::ViewerBase::CullThreadPerCameraDrawThreadPerContext;
|
while (arguments.read("--CullThreadPerCameraDrawThreadPerContext")) threadingModel = osgViewer::ViewerBase::CullThreadPerCameraDrawThreadPerContext;
|
||||||
|
|
||||||
|
#if QT_VERSION >= 0x040800
|
||||||
|
// Required for multithreaded QGLWidget on Linux/X11, see http://blog.qt.io/blog/2011/06/03/threaded-opengl-in-4-8/
|
||||||
|
if (threadingModel != osgViewer::ViewerBase::SingleThreaded)
|
||||||
|
QApplication::setAttribute(Qt::AA_X11InitThreads);
|
||||||
|
#endif
|
||||||
|
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
ViewerWidget* viewWidget = new ViewerWidget(0, Qt::Widget, threadingModel);
|
ViewerWidget* viewWidget = new ViewerWidget(0, Qt::Widget, threadingModel);
|
||||||
viewWidget->setGeometry( 100, 100, 800, 600 );
|
viewWidget->setGeometry( 100, 100, 800, 600 );
|
||||||
|
Loading…
Reference in New Issue
Block a user