diff options
author | Friedemann Kleint <Friedemann.Kleint@digia.com> | 2014-03-06 11:02:48 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-06 17:22:55 +0100 |
commit | 37f5935a8985c38e4f7e227214cc3b0bffec32b0 (patch) | |
tree | 5e5ed9137a0b29526b488655a94634f3c1b4bb6e /tests/auto/opengl | |
parent | 3d73e11ccc721130af520539fd72d5326626e2c6 (diff) |
tst_QGLThreads: Fix errors about makeCurrent() in different thread.
QFATAL : tst_QGLThreads::textureUploadInThread() Cannot make QOpenGLContext current in a different thread
QFATAL : tst_QGLThreads::painterOnPboInThread() Cannot make QOpenGLContext current in a different thread
Task-number: QTBUG-28264
Change-Id: I281cf0593e01b43456410a9a53746bbb15f34f24
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Diffstat (limited to 'tests/auto/opengl')
-rw-r--r-- | tests/auto/opengl/qglthreads/tst_qglthreads.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/auto/opengl/qglthreads/tst_qglthreads.cpp b/tests/auto/opengl/qglthreads/tst_qglthreads.cpp index 63c6cb658b..999761e3f0 100644 --- a/tests/auto/opengl/qglthreads/tst_qglthreads.cpp +++ b/tests/auto/opengl/qglthreads/tst_qglthreads.cpp @@ -216,6 +216,11 @@ public: { m_gl = new QGLWidget(0, shareWidget); moveToThread(this); + + } + + void moveContextToThread() + { m_gl->context()->moveToThread(this); } @@ -307,6 +312,7 @@ void tst_QGLThreads::textureUploadInThread() display.show(); QVERIFY(QTest::qWaitForWindowActive(&display)); + thread.moveContextToThread(); thread.start(); while (thread.isRunning()) { @@ -630,6 +636,12 @@ class PaintThreadManager public: PaintThreadManager(int count) : numThreads(count) { + for (int i=0; i<numThreads; ++i) + devices.append(new T); + // Wait until resize events are processed on the internal + // QGLWidgets of the buffers to suppress errors + // about makeCurrent() from the wrong thread. + QCoreApplication::processEvents(); for (int i=0; i<numThreads; ++i) { devices.append(new T); threads.append(new QThread); |