summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorJocelyn Turcotte <jocelyn.turcotte@digia.com>2014-05-07 11:52:25 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-05-08 13:50:22 +0200
commit9deafdad5b6bee4efc579823ca8f2208c656a340 (patch)
tree4989f11da9a612105e27db5b42b9afa574f0d296 /src/widgets
parenteed30131e168d12ed44e9ed469bef70cd4a80f4e (diff)
Avoid drawing when the QOpenGLWidget isn't mapped
Do as QGLWidget::updateGL does and avoid calling paintGL in updateGL when we we don't have a valid QSurface to draw on. We currently end up calling makeCurrent on the context with a null QSurface in that case, which is the equivalend of doneCurrent, and causes QOpenGLContext::currentContext to return null later when paintGL is called on the subclass. Change-Id: I712ee59274855457b0e4de3757754f56b3528955 Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com> Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/kernel/qopenglwidget.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/widgets/kernel/qopenglwidget.cpp b/src/widgets/kernel/qopenglwidget.cpp
index 10be5aef16..cbefb8a6bf 100644
--- a/src/widgets/kernel/qopenglwidget.cpp
+++ b/src/widgets/kernel/qopenglwidget.cpp
@@ -147,7 +147,7 @@ void QOpenGLWidget::paintGL()
void QOpenGLWidget::updateGL()
{
Q_D(QOpenGLWidget);
- if (d->uninitialized)
+ if (d->uninitialized || !d->surface())
return;
makeCurrent();