aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2020-06-22 15:37:37 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2020-06-23 15:04:28 +0200
commit1f9c12807d4b8d353414765cead74014114d5cd7 (patch)
treee604fdeed8724b0795fc5daf0a9b3606ed625f67
parent52be96b0b8ec052b54c0d82ac17e649c1d5f3905 (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 Change-Id: I50a4f4e06d636fa0ee41fb9b80e720500711854f Reviewed-by: Andy Nichols <andy.nichols@qt.io> (cherry picked from commit 25348752a3c48a8914f79141098db0eec810ebe0) Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
-rw-r--r--src/quickwidgets/qquickwidget.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/quickwidgets/qquickwidget.cpp b/src/quickwidgets/qquickwidget.cpp
index 35cf06927a..6273a140f6 100644
--- a/src/quickwidgets/qquickwidget.cpp
+++ b/src/quickwidgets/qquickwidget.cpp
@@ -989,7 +989,11 @@ void QQuickWidget::createFramebufferObject()
d->offscreenSurface->create();
}
- context->makeCurrent(d->offscreenSurface);
+ bool current = context->makeCurrent(d->offscreenSurface);
+ if (!current) {
+ qWarning("QQuickWidget: Failed to make context current when creating FBO");
+ return;
+ }
int samples = d->requestedSamples;
if (!QOpenGLExtensions(context).hasOpenGLExtension(QOpenGLExtensions::FramebufferMultisample))