summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-10-27 09:49:24 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2011-10-27 09:49:24 (GMT)
commitfadd87f448d3dd4133d1a6ec022ee6db42eb9723 (patch)
tree502d7a9ceb35352751bf364225480d122ee6d50b
parent7ffa94149579448f7060b4483e886b5864d35027 (diff)
parent1220069034f4ad28978427fc584fd63c410f526e (diff)
downloadQt-fadd87f448d3dd4133d1a6ec022ee6db42eb9723.zip
Qt-fadd87f448d3dd4133d1a6ec022ee6db42eb9723.tar.gz
Qt-fadd87f448d3dd4133d1a6ec022ee6db42eb9723.tar.bz2
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-fire-staging into master-integration
* 'master' of scm.dev.nokia.troll.no:qt/qt-fire-staging: Fix possible crash in glyph cache when deleting and creating contexts
-rw-r--r--src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h4
-rw-r--r--src/opengl/qgl.cpp11
-rw-r--r--src/opengl/qgl_p.h1
3 files changed, 15 insertions, 1 deletions
diff --git a/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h b/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h
index 83ca06d..1a8bb0b 100644
--- a/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h
+++ b/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h
@@ -144,6 +144,10 @@ public:
void clear();
+ void contextDeleted(const QGLContext *context) {
+ if (ctx == context)
+ ctx = 0;
+ }
void freeResource(void *) { ctx = 0; }
private:
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index 6d95713..08b9ca3 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -5726,6 +5726,11 @@ void QGLContextGroupResourceBase::cleanup(const QGLContext *ctx)
}
}
+void QGLContextGroupResourceBase::contextDeleted(const QGLContext *ctx)
+{
+ Q_UNUSED(ctx);
+}
+
void QGLContextGroupResourceBase::cleanup(const QGLContext *ctx, void *value)
{
#ifdef QT_GL_CONTEXT_RESOURCE_DEBUG
@@ -5741,12 +5746,16 @@ void QGLContextGroupResourceBase::cleanup(const QGLContext *ctx, void *value)
void QGLContextGroup::cleanupResources(const QGLContext *context)
{
+ // Notify all resources that a context has been deleted
+ QHash<QGLContextGroupResourceBase *, void *>::ConstIterator it;
+ for (it = m_resources.begin(); it != m_resources.end(); ++it)
+ it.key()->contextDeleted(context);
+
// If there are still shares, then no cleanup to be done yet.
if (m_shares.size() > 1)
return;
// Iterate over all resources and free each in turn.
- QHash<QGLContextGroupResourceBase *, void *>::ConstIterator it;
for (it = m_resources.begin(); it != m_resources.end(); ++it)
it.key()->cleanup(context, it.value());
}
diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h
index 945bbaf..df09dfd 100644
--- a/src/opengl/qgl_p.h
+++ b/src/opengl/qgl_p.h
@@ -728,6 +728,7 @@ public:
void cleanup(const QGLContext *context);
void cleanup(const QGLContext *context, void *value);
virtual void freeResource(void *value) = 0;
+ virtual void contextDeleted(const QGLContext *ctx);
protected:
QList<QGLContextGroup *> m_groups;