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>
bb10
Jocelyn Turcotte 2014-05-07 11:52:25 +02:00 committed by The Qt Project
parent eed30131e1
commit 9deafdad5b
1 changed files with 1 additions and 1 deletions

View File

@ -147,7 +147,7 @@ void QOpenGLWidget::paintGL()
void QOpenGLWidget::updateGL()
{
Q_D(QOpenGLWidget);
if (d->uninitialized)
if (d->uninitialized || !d->surface())
return;
makeCurrent();