summaryrefslogtreecommitdiffstats
path: root/src/opengl
diff options
context:
space:
mode:
authorMichael Dominic K <mdk@codethink.co.uk>2010-07-01 08:14:09 (GMT)
committerTrond Kjernåsen <trond.kjernasen@nokia.com>2010-07-01 12:40:27 (GMT)
commitfb00d5003ac5d91953a95d8164180f8f56a2b0f2 (patch)
tree5823232302d1eef315259d1fd8f9983fcb9190e3 /src/opengl
parent4cd1d5ce5fed9519a8c093424ca1ed9beb38dd5e (diff)
downloadQt-fb00d5003ac5d91953a95d8164180f8f56a2b0f2.zip
Qt-fb00d5003ac5d91953a95d8164180f8f56a2b0f2.tar.gz
Qt-fb00d5003ac5d91953a95d8164180f8f56a2b0f2.tar.bz2
Check for EGLSurface leak only when paint device is a QGLWidget.
(not QGLWindowSurface for example). Merge-request: 722 Reviewed-by: Trond
Diffstat (limited to 'src/opengl')
-rw-r--r--src/opengl/qgl_egl.cpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/opengl/qgl_egl.cpp b/src/opengl/qgl_egl.cpp
index 58d3b0a..eafa181 100644
--- a/src/opengl/qgl_egl.cpp
+++ b/src/opengl/qgl_egl.cpp
@@ -232,17 +232,20 @@ void QGLContextPrivate::destroyEglSurfaceForDevice()
if (eglSurface != EGL_NO_SURFACE) {
#ifdef Q_WS_X11
// Make sure we don't call eglDestroySurface on a surface which
- // was created for a different winId:
+ // was created for a different winId. This applies only to QGLWidget
+ // paint device, so make sure this is the one we're operating on
+ // (as opposed to a QGLWindowSurface use case).
if (paintDevice && paintDevice->devType() == QInternal::Widget) {
- QGLWidget* w = static_cast<QGLWidget*>(paintDevice);
-
- if (w->d_func()->eglSurfaceWindowId == w->winId())
- eglDestroySurface(eglContext->display(), eglSurface);
- else
- qWarning("WARNING: Potential EGL surface leak!");
- } else
+ QWidget *w = static_cast<QWidget *>(paintDevice);
+ if (QGLWidget *wgl = qobject_cast<QGLWidget *>(w)) {
+ if (wgl->d_func()->eglSurfaceWindowId != wgl->winId()) {
+ qWarning("WARNING: Potential EGL surface leak! Not destroying surface.");
+ return;
+ }
+ }
+ }
#endif
- eglDestroySurface(eglContext->display(), eglSurface);
+ eglDestroySurface(eglContext->display(), eglSurface);
eglSurface = EGL_NO_SURFACE;
}
}