From cdb4ae34924c8edb607aec0db2fd8b364865e092 Mon Sep 17 00:00:00 2001 From: Yoann Lopes Date: Tue, 31 May 2011 14:37:39 +0200 Subject: [PATCH] Avoid recursive updates in QSGText. --- src/declarative/items/qsgtext.cpp | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/declarative/items/qsgtext.cpp b/src/declarative/items/qsgtext.cpp index e7e655d..8bff100 100644 --- a/src/declarative/items/qsgtext.cpp +++ b/src/declarative/items/qsgtext.cpp @@ -290,6 +290,8 @@ void QSGTextPrivate::updateSize() int dy = q->height(); QSize size(0, 0); + layoutThread = QThread::currentThread(); + //setup instance of QTextLayout for all cases other than richtext if (!richText) { QRect textRect = setupTextLayout(); @@ -378,8 +380,6 @@ QRect QSGTextPrivate::setupTextLayout() bool elideText = false; bool truncate = false; - layoutThread = QThread::currentThread(); - QFontMetrics fm(layout.font()); elidePos = QPointF(); @@ -1064,6 +1064,11 @@ QSGNode *QSGText::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data) Q_UNUSED(data); Q_D(QSGText); + if (d->text.isEmpty()) { + delete oldNode; + return 0; + } + bool richTextAsImage = false; if (d->richText) { d->ensureDoc(); -- 1.7.2.5