diff options
author | Laszlo Agocs <laszlo.agocs@digia.com> | 2013-11-26 13:09:42 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-11-27 09:38:22 +0100 |
commit | 94f1b85cf7e3f8983779a09b55cd22a47ab9203a (patch) | |
tree | 7d5de812894b7dd5520f1b75308d96f77cc2a5f1 /src/gui/kernel/qoffscreensurface.cpp | |
parent | 09466a942e7b940c64b7b4bd64a0069247961501 (diff) |
Check the thread in QOffscreenSurface
The QWindow-based fallback will not work when the QOffscreenSurface is
created outside the main thread. Show a warning in this case.
Note that it is fine to use the QOffscreenSurface instance in another
thread. It is just the creation that must happen on the main thread.
Change-Id: If80da39e610813755b9ba2f6831b187b258b8266
Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
Diffstat (limited to 'src/gui/kernel/qoffscreensurface.cpp')
-rw-r--r-- | src/gui/kernel/qoffscreensurface.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/gui/kernel/qoffscreensurface.cpp b/src/gui/kernel/qoffscreensurface.cpp index e2306050dd..ce913a98af 100644 --- a/src/gui/kernel/qoffscreensurface.cpp +++ b/src/gui/kernel/qoffscreensurface.cpp @@ -160,6 +160,8 @@ void QOffscreenSurface::create() d->platformOffscreenSurface = QGuiApplicationPrivate::platformIntegration()->createPlatformOffscreenSurface(this); // No platform offscreen surface, fallback to an invisible window if (!d->platformOffscreenSurface) { + if (QThread::currentThread() != qGuiApp->thread()) + qWarning("Attempting to create QWindow-based QOffscreenSurface outside the gui thread. Expect failures."); d->offscreenWindow = new QWindow(d->screen); d->offscreenWindow->setSurfaceType(QWindow::OpenGLSurface); d->offscreenWindow->setFormat(d->requestedFormat); |