summaryrefslogtreecommitdiffstats
path: root/src/opengl
diff options
context:
space:
mode:
authorTom Cooksey <thomas.cooksey@nokia.com>2009-10-01 16:01:20 (GMT)
committerTom Cooksey <thomas.cooksey@nokia.com>2009-10-01 16:13:02 (GMT)
commit2a54ab7fe6f3979a75154a02c0c810cf6cd28033 (patch)
treeb4d565248a404fcf1fa76f147d9095bdc8a5c05c /src/opengl
parented6a2701320db60dd256df61a8030a867b917302 (diff)
downloadQt-2a54ab7fe6f3979a75154a02c0c810cf6cd28033.zip
Qt-2a54ab7fe6f3979a75154a02c0c810cf6cd28033.tar.gz
Qt-2a54ab7fe6f3979a75154a02c0c810cf6cd28033.tar.bz2
Fix BadDrawable errors when re-parenting a QGLWidget on X11/EGL
It's actually not really reparenting, but calling setWindowFlags which triggered the errors. But setWindowFlags causes a re-parent. The context isn't really the right please to free the surface, but fixing that is a much more intrusive change. Reviewed-By: TrustMe
Diffstat (limited to 'src/opengl')
-rw-r--r--src/opengl/qgl_egl.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/opengl/qgl_egl.cpp b/src/opengl/qgl_egl.cpp
index 6c93bea..fa876c7 100644
--- a/src/opengl/qgl_egl.cpp
+++ b/src/opengl/qgl_egl.cpp
@@ -142,8 +142,19 @@ void QGLContext::reset()
d->cleanup();
doneCurrent();
if (d->eglContext) {
- if (d->eglSurface != EGL_NO_SURFACE)
- eglDestroySurface(d->eglContext->display(), d->eglSurface);
+ if (d->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:
+ if (d->paintDevice->devType() == QInternal::Widget) {
+ QGLWidget* w = static_cast<QGLWidget*>(d->paintDevice);
+
+ if (w->d_func()->eglSurfaceWindowId == w->winId())
+ eglDestroySurface(d->eglContext->display(), d->eglSurface);
+ } else
+#endif
+ eglDestroySurface(d->eglContext->display(), d->eglSurface);
+ }
delete d->eglContext;
}
d->eglContext = 0;