Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-31580

TextEdit is trying to remove a paintedNode which is null and crashes

    XMLWordPrintable

Details

    • 672354676d8e968e2523d1aeb450213a46b8b27c

    Description

      In the designer we reparent a item and the the the paintedNode of the item is set to null. QQuickTextEdit::updatePaintNode is not handling this case.

      The following diff is a hot fix but I think the case could be handled better.

      diff --git a/src/quick/items/qquicktextedit.cpp b/src/quick/items/qquicktextedit.cpp
      index 327b086..101761a 100644
      --- a/src/quick/items/qquicktextedit.cpp
      +++ b/src/quick/items/qquicktextedit.cpp
      @@ -1755,7 +1755,8 @@ QSGNode *QQuickTextEdit::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *
       
               // FIXME: the text decorations could probably be handled separately (only updated for affected textFrames)
               if (d->frameDecorationsNode) {
      -            rootNode->removeChildNode(d->frameDecorationsNode);
      +            if (oldNode)
      +                rootNode->removeChildNode(d->frameDecorationsNode);
                   delete d->frameDecorationsNode;
               }
               d->frameDecorationsNode = d->createTextNode();
      @@ -1865,7 +1866,7 @@ QSGNode *QQuickTextEdit::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *
               QColor color = (!d->cursorVisible || !d->control->cursorOn())
                       ? QColor(0, 0, 0, 0)
                       : d->color;
      -        if (d->cursorNode)
      +        if (d->cursorNode && oldNode)
                   rootNode->removeChildNode(d->cursorNode);
               delete d->cursorNode;
               d->cursorNode = new QSGSimpleRectNode(cursorRectangle(), color);
      

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              ntg Pierre Rossi
              bubke Marco Bubke
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes