From 1056d02ee07ab9bba3a4dd9f5fd483d45773e665 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 30 Aug 2011 10:12:46 +0200 Subject: Cause fatal error when trying to make a context current in wrong thread. 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 Reviewed-by: Gunnar Sletta --- src/gui/kernel/qopenglcontext.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/gui') diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp index 883b60961e..e61c117bfa 100644 --- a/src/gui/kernel/qopenglcontext.cpp +++ b/src/gui/kernel/qopenglcontext.cpp @@ -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; -- cgit v1.2.3