Details
-
Bug
-
Resolution: Out of scope
-
P2: Important
-
4.6.2
-
None
Description
Found this with QPlainTextEdit when using document where apply QTextBlock::setVisible(false), it leads to crash if some text blocks are hidden. Especially after widget resize, just one mouse click on the widget can create the crash.
It looks like that in case of hidden text blocks, the code in
qplaintextedit.cpp - QPlainTextEditControl::blockBoundingRect()
line ~ 579
currentBlock = doc->findBlockByLineNumber(currentBlock.firstLineNumber());
returns broken (invalid) QTextBlock
because next line
currentBlockNumber = currentBlock.blockNumber();
produced "-1"
Simple test case attached.
It shows some content, then on timeout start show/hide text block.
Usually it is enough just to mouse click to content to make crash (maybe + window resize)
Also strange thing - found that can not reproduce the crash until some initialization or widgets happens before using QPlainTextEdit
Getting next backtrace:
Date/Time: 2010-04-01 10:40:58.614 +0200 OS Version: Mac OS X 10.5.8 (9L30) Report Version: 6 Anonymous UUID: 422BF2FD-3FFD-408E-8A1A-056F302EF776 Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x00000000e72d4d78 Crashed Thread: 0 Thread 0 Crashed: 0 QtGui 0x00e97545 QFragmentMapData<QTextBlockData>::next(unsigned int) const + 37 1 QtGui 0x00e9669d QTextBlock::next() const + 45 2 QtGui 0x01129021 QPlainTextEditControl::blockBoundingRect(QTextBlock const&) const + 1265 3 QtGui 0x00e6c10d QTextControlPrivate::rectForPosition(int) const + 157 4 QtGui 0x00e6f2bb QTextControl::selectionRect(QTextCursor const&) const + 75 5 QtGui 0x00e703d6 QTextControl::selectionRect() const + 38 6 QtGui 0x00e7080d QTextControlPrivate::focusEvent(QFocusEvent*) + 29 7 QtGui 0x00e77508 QTextControl::processEvent(QEvent*, QMatrix const&, QWidget*) + 1528 8 QtGui 0x00e698b7 QTextControl::processEvent(QEvent*, QPointF const&, QWidget*) + 87 9 QtGui 0x0112f74f QPlainTextEdit::focusInEvent(QFocusEvent*) + 159 10 QtGui 0x00ca0234 QWidget::event(QEvent*) + 3508 11 QtGui 0x01076185 QFrame::event(QEvent*) + 37 12 QtGui 0x0110c30f QAbstractScrollArea::event(QEvent*) + 127 13 QtGui 0x0112e44e QPlainTextEdit::event(QEvent*) + 78 14 QtGui 0x00c46a6f QApplicationPrivate::notify_helper(QObject*, QEvent*) + 175 15 QtGui 0x00c4c981 QApplication::notify(QObject*, QEvent*) + 289 16 QtCore 0x002fe9c2 QCoreApplication::notifyInternal(QObject*, QEvent*) + 98 17 QtGui 0x00c4a568 QApplicationPrivate::setFocusWidget(QWidget*, Qt::FocusReason) + 776 18 QtGui 0x00c4ab66 QApplication::setActiveWindow(QWidget*) + 1254 19 QtGui 0x00bdda1e QApplicationPrivate::globalEventProcessor(OpaqueEventHandlerCallRef*, OpaqueEventRef*, void*) + 4862 20 com.apple.HIToolbox 0x93f1a13d DispatchEventToHandlers(EventTargetRec*, OpaqueEventRef*, HandlerCallRec*) + 1181 21 com.apple.HIToolbox 0x93f1957b SendEventToEventTargetInternal(OpaqueEventRef*, OpaqueEventTargetRef*, HandlerCallRec*) + 405 22 com.apple.HIToolbox 0x93f193e0 SendEventToEventTargetWithOptions + 58 23 com.apple.HIToolbox 0x93f9e485 PostActivateEvent + 381 24 com.apple.HIToolbox 0x93f9df17 HiliteAndActivateWindow + 381 25 com.apple.HIToolbox 0x941dbe11 AdjustToNewWindowActivation(WindowData*, WindowContext*, OpaqueWindowPtr*, unsigned char, WindowData*) + 225 26 com.apple.HIToolbox 0x93f9f120 PotentiallyAdjustToNewWindowActivation(WindowData*, WindowData*, WindowContext*, OpaqueWindowPtr*, WindowData*) + 126 27 com.apple.HIToolbox 0x93f9f06a BringToFrontAndActivateWindow(WindowData*, OpaqueWindowGroupRef*, unsigned char) + 134 28 com.apple.HIToolbox 0x93f9ef27 WindowData::SelectWindow() + 229 29 QtGui 0x00beaed2 QWidget::activateWindow() + 434