diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2020-06-22 15:37:37 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2020-06-22 16:10:17 +0200 |
commit | 25348752a3c48a8914f79141098db0eec810ebe0 (patch) | |
tree | 6619fbe7af6179dedeb4777b8a395370885f3ac8 | |
parent | 44af3bd0f7b5a087f878ae626bc36250586c6e49 (diff) |
QQuickWidget: do not crash when failing to make context current
...in createFramebufferObject(), e.g. upon resizing.
Certain systems have a problem with OpenGL contexts during resizing,
according to user reports. We do not know why makeCurrent() would fail,
so we cannot prevent the failure, but we can check the result of
makeCurrent() and not go on doing GL stuff (which would almost certainly
crash) without a valid context.
Task-number: QTBUG-83319
Pick-to: 5.15
Change-Id: I50a4f4e06d636fa0ee41fb9b80e720500711854f
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
-rw-r--r-- | src/quickwidgets/qquickwidget.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/quickwidgets/qquickwidget.cpp b/src/quickwidgets/qquickwidget.cpp index 6fea6c6689..2da5e21fb8 100644 --- a/src/quickwidgets/qquickwidget.cpp +++ b/src/quickwidgets/qquickwidget.cpp @@ -1032,7 +1032,11 @@ void QQuickWidget::createFramebufferObject() d->offscreenSurface->create(); } - d->context->makeCurrent(d->offscreenSurface); + bool current = d->context->makeCurrent(d->offscreenSurface); + if (!current) { + qWarning("QQuickWidget: Failed to make context current when creating FBO"); + return; + } int samples = d->requestedSamples; if (!QOpenGLExtensions(d->context).hasOpenGLExtension(QOpenGLExtensions::FramebufferMultisample)) |