Cause fatal error when trying to make a context current in wrong thread.
authorSamuel Rødal <samuel.rodal@nokia.com>
Tue, 30 Aug 2011 08:12:46 +0000 (10:12 +0200)
committerGunnar Sletta <gunnar.sletta@nokia.com>
Tue, 30 Aug 2011 08:50:53 +0000 (10:50 +0200)
Since QOpenGLContext is now a QObject, it needs to be moved to, or
created in, the thread where it's going to be used.

Change-Id: I7ed12b25e75c84bb12be8c7102e46e9a242fc2df
Reviewed-on: http://codereview.qt.nokia.com/3858
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
src/gui/kernel/qopenglcontext.cpp

index 883b609..e61c117 100644 (file)
@@ -226,6 +226,9 @@ bool QOpenGLContext::makeCurrent(QSurface *surface)
     if (!d->platformGLContext)
         return false;
 
+    if (thread() != QThread::currentThread())
+        qFatal("Cannot make QOpenGLContext current in a different thread");
+
     if (!surface) {
         doneCurrent();
         return true;