diff options
author | Benny Morgan <benny@zuragon.com> | 2016-06-30 09:37:41 +0200 |
---|---|---|
committer | Miikka Heikkinen <miikka.heikkinen@qt.io> | 2016-06-30 09:36:06 +0000 |
commit | 95884805facd1721eea025467afd85ed64a70504 (patch) | |
tree | b5207d12da4a1badd9ac907655e69ed833d99adf /src | |
parent | 7919112bf8bb4e1e99c7e9b57310e95598363522 (diff) |
CanvasRenderJob: check if QOpenGLContext::currentContext() is NULL
Using a Canvas3D inside a QQuickWidget, for some reason sometimes QOpenGLContext::currentContext() is NULL,
that causes a crash in CanvasRenderJob.
The easy fix that seems to work is to just check QOpenGLContext::currentContext() if is NULL and so prevent the application to crash
Task-number: QTBUG-54466
Change-Id: Icbc0e1500b06d3768bd238e54533b20f72e31500
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/imports/qtcanvas3d/renderjob.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/imports/qtcanvas3d/renderjob.cpp b/src/imports/qtcanvas3d/renderjob.cpp index 754aacb..4719251 100644 --- a/src/imports/qtcanvas3d/renderjob.cpp +++ b/src/imports/qtcanvas3d/renderjob.cpp @@ -82,7 +82,9 @@ void CanvasRenderJob::run() QSurface *oldSurface(0); if (!m_renderer->usingQtContext()) { oldContext = QOpenGLContext::currentContext(); - oldSurface = oldContext->surface(); + if (oldContext) + oldSurface = oldContext->surface(); + m_renderer->makeCanvasContextCurrent(); } |