Fix high CPU load for Qml TextEdit on Mac
authorNils Jeisecke <jeisecke@saltation.de>
Mon, 2 Jul 2012 13:38:24 +0000 (15:38 +0200)
committerQt by Nokia <qt-info@nokia.com>
Mon, 2 Jul 2012 15:13:37 +0000 (17:13 +0200)
This removes a Mac workaround which causes an endless calling loop
(updatePaintNode will call markContentsDirty will call updatePaintNode) for
every TextEdit element. The only reason that
this doesn't block the application is that the signal goes through the
GUI thread's event loop.

Task-number: QTBUG-26361
Change-Id: Ia89cc123959bbfdcbfc5b0707901ac91dec47c40
Reviewed-by: Jiang Jiang <jiang.jiang@nokia.com>
src/quick/items/qquicktextedit.cpp

index 7222c17..7f31eb4 100644 (file)
@@ -1605,13 +1605,6 @@ QSGNode *QQuickTextEdit::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *
     if (oldNode == 0 || d->documentDirty) {
         d->documentDirty = false;
 
-#if defined(Q_OS_MAC)
-        // Make sure document is relayouted in the paint node on Mac
-        // to avoid crashes due to the font engines created in the
-        // shaping process
-        d->document->markContentsDirty(0, d->document->characterCount());
-#endif
-
         QQuickTextNode *node = 0;
         if (oldNode == 0) {
             node = new QQuickTextNode(QQuickItemPrivate::get(this)->sceneGraphContext(), this);
@@ -1629,13 +1622,6 @@ QSGNode *QQuickTextEdit::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *
                               QColor(), d->selectionColor, d->selectedTextColor, selectionStart(),
                               selectionEnd() - 1);  // selectionEnd() returns first char after
                                                     // selection
-
-#if defined(Q_OS_MAC)
-        // We also need to make sure the document layout is redone when
-        // control is returned to the main thread, as all the font engines
-        // are now owned by the rendering thread
-        d->document->markContentsDirty(0, d->document->characterCount());
-#endif
     }
 
     if (d->cursorComponent == 0 && !isReadOnly()) {