summaryrefslogtreecommitdiffstats
path: root/src/opengl
diff options
context:
space:
mode:
authorTom Cooksey <thomas.cooksey@nokia.com>2010-04-23 15:21:39 (GMT)
committerTom Cooksey <thomas.cooksey@nokia.com>2010-04-26 06:26:01 (GMT)
commitbdd7372edf4cb64177e97ef6087a6ec2a4903225 (patch)
tree37ca619f5352350dd32c7fef88df9e700cbc4959 /src/opengl
parent372392153a2c1de69d9257753ba84f44cbbd9cf1 (diff)
downloadQt-bdd7372edf4cb64177e97ef6087a6ec2a4903225.zip
Qt-bdd7372edf4cb64177e97ef6087a6ec2a4903225.tar.gz
Qt-bdd7372edf4cb64177e97ef6087a6ec2a4903225.tar.bz2
Don't leak objects if QX11GLSharedContexts is instanciated twice
If two threads call the Q_GLOBAL_STATIC accessor at the same time, two QX11GLSharedContexts objects can be created with one being destroyed. Reviewed-By: TrustMe
Diffstat (limited to 'src/opengl')
-rw-r--r--src/opengl/qpixmapdata_x11gl_egl.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/opengl/qpixmapdata_x11gl_egl.cpp b/src/opengl/qpixmapdata_x11gl_egl.cpp
index e0c274a..2c11a0b 100644
--- a/src/opengl/qpixmapdata_x11gl_egl.cpp
+++ b/src/opengl/qpixmapdata_x11gl_egl.cpp
@@ -74,7 +74,6 @@ public:
EGLint rgbConfigId;
EGLint argbConfigId;
-
do {
EGLConfig rgbConfig = QEgl::defaultConfig(QInternal::Pixmap, QEgl::OpenGL, QEgl::Renderable);
EGLConfig argbConfig = QEgl::defaultConfig(QInternal::Pixmap, QEgl::OpenGL,
@@ -138,6 +137,7 @@ public:
valid = argbContext->makeCurrent(argbPixmapSurface);
argbContext->doneCurrent();
eglDestroySurface(QEgl::display(), argbPixmapSurface);
+ argbPixmapData->gl_surface = 0;
}
if (!valid) {
@@ -150,7 +150,6 @@ public:
QGLTextureCache::instance();
} while(0);
-
if (!valid)
cleanup();
else
@@ -158,6 +157,10 @@ public:
}
+ ~QX11GLSharedContexts() {
+ cleanup();
+ }
+
void cleanup() {
if (sharedQGLContext) {
delete sharedQGLContext;
@@ -222,8 +225,8 @@ bool QX11GLPixmapData::hasX11GLPixmaps()
if (checkedForX11GLPixmaps)
return haveX11GLPixmaps;
+ haveX11GLPixmaps = qt_x11gl_share_contexts()->isValid();
checkedForX11GLPixmaps = true;
- haveX11GLPixmaps = sharedContexts()->isValid();
return haveX11GLPixmaps;
}