Avoid recursive updates in QSGText.
authorYoann Lopes <yoann.lopes@nokia.com>
Tue, 31 May 2011 12:37:39 +0000 (14:37 +0200)
committerYoann Lopes <yoann.lopes@nokia.com>
Tue, 31 May 2011 12:37:39 +0000 (14:37 +0200)
src/declarative/items/qsgtext.cpp

index e7e655d..8bff100 100644 (file)
@@ -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();