diff options
author | Rhys Weatherley <rhys.weatherley@nokia.com> | 2009-10-05 01:55:53 (GMT) |
---|---|---|
committer | Rhys Weatherley <rhys.weatherley@nokia.com> | 2009-10-05 01:55:53 (GMT) |
commit | 7b19bfec4c496f2112b363cbdc8a0c302a48cfce (patch) | |
tree | 0de2b3f93d6b58aa54c31a39ca44d1cb8fea0337 /src/opengl/gl2paintengineex/qglgradientcache.cpp | |
parent | a3add3d6ab1b7a3e4dbb2df81fd51625b834fe45 (diff) | |
download | Qt-7b19bfec4c496f2112b363cbdc8a0c302a48cfce.zip Qt-7b19bfec4c496f2112b363cbdc8a0c302a48cfce.tar.gz Qt-7b19bfec4c496f2112b363cbdc8a0c302a48cfce.tar.bz2 |
Consistently use QGLShareContextScope for context switching
QGLShareContextScope is safer and more reliable than trying to manually
detect how and when to temporarily switch contexts. Replace the few
remaining instances of context-switching with it.
Reviewed-by: trustme
Diffstat (limited to 'src/opengl/gl2paintengineex/qglgradientcache.cpp')
-rw-r--r-- | src/opengl/gl2paintengineex/qglgradientcache.cpp | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/src/opengl/gl2paintengineex/qglgradientcache.cpp b/src/opengl/gl2paintengineex/qglgradientcache.cpp index 4b2b2a0..e06f15d 100644 --- a/src/opengl/gl2paintengineex/qglgradientcache.cpp +++ b/src/opengl/gl2paintengineex/qglgradientcache.cpp @@ -57,13 +57,9 @@ QGL2GradientCache *QGL2GradientCache::cacheForContext(const QGLContext *context) { QGL2GradientCache *p = reinterpret_cast<QGL2GradientCache *>(qt_gradient_caches()->value(context)); if (!p) { - QGLContext *oldContext = const_cast<QGLContext *>(QGLContext::currentContext()); - if (oldContext != context) - const_cast<QGLContext *>(context)->makeCurrent(); + QGLShareContextScope scope(context); p = new QGL2GradientCache; qt_gradient_caches()->insert(context, p); - if (oldContext && oldContext != context) - oldContext->makeCurrent(); } return p; } |