aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickgenericshadereffect.cpp
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2016-07-14 14:09:28 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2016-07-15 09:30:37 +0000
commitf3200a1f979c4f77d6d5f8960c8f09230cbe622f (patch)
treee5c2cecbd4f858d42bce1f9b83c4a7e84a7eb5c1 /src/quick/items/qquickgenericshadereffect.cpp
parentd7f88158050122c28e078fd407322cbf53a875fa (diff)
software: Fix potential infinite loop with ShaderEffect
With the software backend we entered an infinite loop when having ShaderEffect items. The previous change introducing the usage of polish requests to defer shader processing was a bit too keen on trying over and over again: there is exactly one retry attempt we need, not more. If the second fails too and everything looks initialized and ready, then we know the backend has no shader effect support so it is futile to try again. Change-Id: Ibaaefd45e5b26d0be42dbe7f9c080363b7a939bf Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/quick/items/qquickgenericshadereffect.cpp')
-rw-r--r--src/quick/items/qquickgenericshadereffect.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/quick/items/qquickgenericshadereffect.cpp b/src/quick/items/qquickgenericshadereffect.cpp
index 683453d4ee..9714f39663 100644
--- a/src/quick/items/qquickgenericshadereffect.cpp
+++ b/src/quick/items/qquickgenericshadereffect.cpp
@@ -305,8 +305,16 @@ void QQuickGenericShaderEffect::maybeUpdateShaders()
m_vertNeedsUpdate = !updateShader(Vertex, m_vertShader);
if (m_fragNeedsUpdate)
m_fragNeedsUpdate = !updateShader(Fragment, m_fragShader);
- if (m_vertNeedsUpdate || m_fragNeedsUpdate)
- m_item->polish();
+ if (m_vertNeedsUpdate || m_fragNeedsUpdate) {
+ // This function is invoked either from componentComplete or in a
+ // response to a previous invocation's polish() request. If this is
+ // case #1 then updateShader can fail due to not having a window or
+ // scenegraph ready. Schedule the polish to try again later. In case #2
+ // the backend probably does not have shadereffect support so there is
+ // nothing to do for us here.
+ if (!m_item->window() || !m_item->window()->isSceneGraphInitialized())
+ m_item->polish();
+ }
}
void QQuickGenericShaderEffect::handleItemChange(QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &value)