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>bb10
parent
3d73e11ccc
commit
37f5935a89
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue