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>
This commit is contained in:
parent
09466a942e
commit
94f1b85cf7
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user