aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar.sletta@digia.com>2013-11-20 13:27:02 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-11-22 22:34:00 +0100
commit8eca830fab1f8a27d62602f2725afc7cdc3561aa (patch)
treecc95e3574775d27555106868139be9a9393a857f
parent2c7bf3992ba079a632f0f5fdef64e6ca10eaf13f (diff)
Safeguard the threaded renderloop against incorrectly exposed windows.
On Mac we had a situation where we got expose events for windows which were either 0x24 in size or completely off the screen. These would result in makeCurrent failing and lead to crashes later on in the scene graph. Safeguard against invalid dimensions during initialization and abort after a call to makeCurrent if any of them fail. Task-number: QTCREATORBUG-10814 Change-Id: I9063ea4d078eea3914666e4c155d141a1502e2ff Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
-rw-r--r--src/quick/scenegraph/qsgthreadedrenderloop.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
index 0c46747e53..2de9827ab1 100644
--- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp
+++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
@@ -506,7 +506,10 @@ void QSGRenderThread::sync()
Q_ASSERT_X(wm->m_locked, "QSGRenderThread::sync()", "sync triggered on bad terms as gui is not already locked...");
- if (windowSize.width() > 0 && windowSize.height() > 0) {
+ bool current = false;
+ if (windowSize.width() > 0 && windowSize.height() > 0)
+ current = gl->makeCurrent(window);
+ if (current) {
gl->makeCurrent(window);
QQuickWindowPrivate *d = QQuickWindowPrivate::get(window);
bool hadRenderer = d->renderer != 0;
@@ -578,8 +581,10 @@ void QSGRenderThread::syncAndRender()
d->animationController->unlock();
}
- if (d->renderer && windowSize.width() > 0 && windowSize.height() > 0) {
- gl->makeCurrent(window);
+ bool current = false;
+ if (d->renderer && windowSize.width() > 0 && windowSize.height() > 0)
+ current = gl->makeCurrent(window);
+ if (current) {
d->renderSceneGraph(windowSize);
#ifndef QSG_NO_RENDER_TIMING
if (profileFrames)
@@ -654,10 +659,8 @@ void QSGRenderThread::run()
while (active) {
if (window) {
- if (!sgrc->openglContext()) {
- gl->makeCurrent(window);
+ if (!sgrc->openglContext() && windowSize.width() > 0 && windowSize.height() > 0 && gl->makeCurrent(window))
sgrc->initialize(gl);
- }
syncAndRender();
}