From fd85542d8fc2afed199b9c976c07981d4f8ae985 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 23 Jan 2014 10:09:53 +0000 Subject: [PATCH] Cleaned up the Qt find package, and made changed the default threading model to SingleThreaded when using Qt5 to avoid crash due to regresssion since Qt4. --- CMakeLists.txt | 2 +- examples/osgviewerQt/osgviewerQt.cpp | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 129bbedc6..a57f27e86 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -601,7 +601,7 @@ IF(OSG_USE_QT AND NOT ANDROID) #If we have found Qt5, let's try to top off by getting the webkit as well IF ( Qt5Widgets_FOUND ) - FIND_PACKAGE(Qt5WebKitWidgets) + FIND_PACKAGE(Qt5WebKitWidgets QUIET) ENDIF() ENDIF() diff --git a/examples/osgviewerQt/osgviewerQt.cpp b/examples/osgviewerQt/osgviewerQt.cpp index 2895b2d23..5e3917df9 100644 --- a/examples/osgviewerQt/osgviewerQt.cpp +++ b/examples/osgviewerQt/osgviewerQt.cpp @@ -93,7 +93,13 @@ int main( int argc, char** argv ) { osg::ArgumentParser arguments(&argc, argv); +#if QT_VERSION >= 0x050000 + // Qt5 is currently crashing and reporting "Cannot make QOpenGLContext current in a different thread" when the viewer is run multi-threaded, this is regression from Qt4 + osgViewer::ViewerBase::ThreadingModel threadingModel = osgViewer::ViewerBase::SingleThreaded; +#else osgViewer::ViewerBase::ThreadingModel threadingModel = osgViewer::ViewerBase::CullDrawThreadPerContext; +#endif + while (arguments.read("--SingleThreaded")) threadingModel = osgViewer::ViewerBase::SingleThreaded; while (arguments.read("--CullDrawThreadPerContext")) threadingModel = osgViewer::ViewerBase::CullDrawThreadPerContext; while (arguments.read("--DrawThreadPerContext")) threadingModel = osgViewer::ViewerBase::DrawThreadPerContext;