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

When a QLabel with \n\n\n at the end of the string gets resized then it can cause a crash

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 4.8.1
    • 4.8.0
    • GUI: Text handling
    • None
    • Mac OS X
    • 81df02625ae7c5139fa409d1147a519629b7635c

    Description

      When a QLabel with \n\n\n at the end of the string gets resized then it can cause a crash. In the example attached when resizing the window it will crash on Mac. It does not crash within gdb however, only outside of it with this call stack:

      Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
      0   QtGui                         	0x00000001002a8250 QTextLineItemIterator::next() + 370
      1   QtGui                         	0x00000001002b02af QTextLine::draw(QPainter*, QPointF const&, QTextLayout::FormatRange const*) const + 995
      2   QtGui                         	0x00000001001bab4a qt_format_text(QFont const&, QRectF const&, int, QTextOption const*, QString const&, QRectF*, int, int*, int, QPainter*) + 4026
      3   QtGui                         	0x00000001001bb213 QPainter::drawText(QRect const&, int, QString const&, QRect*) + 265
      4   QtGui                         	0x000000010033563b QStyle::drawItemText(QPainter*, QRect const&, int, QPalette const&, bool, QString const&, QPalette::ColorRole) const + 529
      5   QtGui                         	0x000000010042f8e8 QLabel::paintEvent(QPaintEvent*) + 2208
      6   QtGui                         	0x00000001000d3913 QWidget::event(QEvent*) + 1389
      7   QtGui                         	0x000000010042b072 QFrame::event(QEvent*) + 40
      8   QtGui                         	0x000000010042ff87 QLabel::event(QEvent*) + 241
      9   QtGui                         	0x0000000100084ca8 QApplicationPrivate::notify_helper(QObject*, QEvent*) + 304
      10  QtGui                         	0x0000000100084f26 QApplication::notify(QObject*, QEvent*) + 600
      11  QtCore                        	0x0000000100d55532 QCoreApplication::notifyInternal(QObject*, QEvent*) + 104
      12  QtGui                         	0x00000001000d6e41 QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) + 2055
      13  QtGui                         	0x00000001000d7658 QWidgetPrivate::paintSiblingsRecursive(QPaintDevice*, QList<QObject*> const&, int, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) + 762
      14  QtGui                         	0x00000001000d71d7 QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) + 2973
      15  QtGui                         	0x00000001000303e8 -[QCocoaView drawRect:] + 3048
      16  com.apple.AppKit              	0x00007fff8e181fdf -[NSView _drawRect:clip:] + 3758
      17  com.apple.AppKit              	0x00007fff8e1af8c4 -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 1583
      18  com.apple.AppKit              	0x00007fff8e17f5ba -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 1032
      19  com.apple.AppKit              	0x00007fff8e18086f -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 5821
      20  com.apple.AppKit              	0x00007fff8e17eab3 -[NSThemeFrame _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 270
      21  com.apple.AppKit              	0x00007fff8e179ec9 -[NSView _displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] + 4755
      22  com.apple.AppKit              	0x00007fff8e17293e -[NSView displayIfNeeded] + 1676
      23  com.apple.AppKit              	0x00007fff8e291d76 -[NSThemeFrame handleSetFrameCommonRedisplay] + 209
      24  com.apple.AppKit              	0x00007fff8e2348cc -[NSWindow _setFrameCommon:display:stashSize:] + 2477
      25  com.apple.AppKit              	0x00007fff8e233f17 -[NSWindow setFrame:display:] + 60
      26  com.apple.AppKit              	0x00007fff8e284cca -[NSWindow(NSWindowResizing) _resizeWithEvent:] + 1498
      27  com.apple.AppKit              	0x00007fff8e28468f -[NSTitledFrame mouseDown:] + 187
      28  com.apple.AppKit              	0x00007fff8e2845a0 -[NSThemeFrame mouseDown:] + 665
      29  com.apple.AppKit              	0x00007fff8e2040e0 -[NSWindow sendEvent:] + 6306
      30  QtGui                         	0x000000010003393f -[QCocoaWindow sendEvent:] + 111
      31  com.apple.AppKit              	0x00007fff8e19c68f -[NSApplication sendEvent:] + 5593
      32  QtGui                         	0x0000000100037142 -[QNSApplication sendEvent:] + 82
      33  com.apple.AppKit              	0x00007fff8e132682 -[NSApplication run] + 555
      34  QtGui                         	0x0000000100040350 QEventDispatcherMac::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 840
      35  QtCore                        	0x0000000100d52ab8 QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 394
      36  QtCore                        	0x0000000100d55c83 QCoreApplication::exec() + 175
      37  com.yourcompany.283660        	0x000000010000268f main + 495 (main.cpp:9)
      38  com.yourcompany.283660        	0x000000010000206a _start + 248
      39  com.yourcompany.283660        	0x0000000100001f71 start + 33
      

      Attachments

        1. main.cpp
          0.2 kB
          Andy Shaw
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            jiang Jiang Jiang
            andysh Andy Shaw
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes