summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar.sletta@nokia.com>2010-12-06 20:41:43 +0100
committerGunnar Sletta <gunnar.sletta@nokia.com>2010-12-06 20:41:43 +0100
commit327183d0d6af2f46d448603d58ff418c3add7cdf (patch)
treef345a40930ea75834d3d10c986fd992a1201cd5b
parent05272a69e709e9b423afe352cdc5eaf3b3d22901 (diff)
Delay starting the thread until after we have initialized the context.
The order should be: 1. initialize / create thread context 2. start thread 3. make thread context current in thread 4. upload, upload, upload...
-rw-r--r--src/adaptationlayers/threadedtexturemanager.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/adaptationlayers/threadedtexturemanager.cpp b/src/adaptationlayers/threadedtexturemanager.cpp
index 665dbd9..46f06a0 100644
--- a/src/adaptationlayers/threadedtexturemanager.cpp
+++ b/src/adaptationlayers/threadedtexturemanager.cpp
@@ -27,7 +27,6 @@ public:
QSGTTMUploadThread(QSGThreadedTextureManager *m)
: manager(m)
{
- start();
}
void run() {
@@ -86,6 +85,7 @@ const TextureReference *QSGThreadedTextureManager::requestUploadedTexture(const
if (!d->thread) {
d->thread = new QSGTTMUploadThread(this);
initializeThreadContext();
+ d->thread->start();
}
Q_ASSERT(!image.isNull());
@@ -132,6 +132,8 @@ void QSGThreadedTextureManager::initializeThreadContext()
d->widget->resize(8, 8);
d->context = const_cast<QGLContext *>(d->widget->context());
+ if (!d->context)
+ qFatal("QSGThreadedTextureManager: failed to create thread context...");
d->widget->doneCurrent();