summaryrefslogtreecommitdiffstats
path: root/src/opengl
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2010-09-10 13:35:34 (GMT)
committerSamuel Rødal <samuel.rodal@nokia.com>2010-09-10 13:50:28 (GMT)
commite78274d5f8c0eb5c10b9b58e069b90b6475c6f71 (patch)
tree0a1333ea5af1eb99e8048ab88106d7346259861d /src/opengl
parent8a43ccdaf3bbd1e77045cbb63231e201ea23896f (diff)
downloadQt-e78274d5f8c0eb5c10b9b58e069b90b6475c6f71.zip
Qt-e78274d5f8c0eb5c10b9b58e069b90b6475c6f71.tar.gz
Qt-e78274d5f8c0eb5c10b9b58e069b90b6475c6f71.tar.bz2
Prevented crash in GL window surface when deleting native child widgets.
We should only destroy the FBO if it's the actual window that's deleted. Reviewed-by: Trond
Diffstat (limited to 'src/opengl')
-rw-r--r--src/opengl/qwindowsurface_gl.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp
index 48c7deb..f98dcff 100644
--- a/src/opengl/qwindowsurface_gl.cpp
+++ b/src/opengl/qwindowsurface_gl.cpp
@@ -345,12 +345,14 @@ QGLWindowSurface::~QGLWindowSurface()
void QGLWindowSurface::deleted(QObject *object)
{
- // Make sure that the fbo is destroyed before destroying its context.
- delete d_ptr->fbo;
- d_ptr->fbo = 0;
-
QWidget *widget = qobject_cast<QWidget *>(object);
if (widget) {
+ if (widget == window()) {
+ // Make sure that the fbo is destroyed before destroying its context.
+ delete d_ptr->fbo;
+ d_ptr->fbo = 0;
+ }
+
QWidgetPrivate *widgetPrivate = widget->d_func();
if (widgetPrivate->extraData()) {
union { QGLContext **ctxPtr; void **voidPtr; };
@@ -422,6 +424,8 @@ QPaintDevice *QGLWindowSurface::paintDevice()
QGLContext *ctx = reinterpret_cast<QGLContext *>(window()->d_func()->extraData()->glContext);
ctx->makeCurrent();
+
+ Q_ASSERT(d_ptr->fbo);
return d_ptr->fbo;
}