Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
6.3.0
-
None
-
-
9fcd5f0790 (qt/qtbase/dev) 9fcd5f0790 (qt/tqtc-qtbase/dev) 87d4cb06b1 (qt/qtbase/6.4) 87d4cb06b1 (qt/tqtc-qtbase/6.4) c808f94167 (qt/tqtc-qtbase/6.2) 7a0f50942d (qt/qtbase/6.3) 7a0f50942d (qt/tqtc-qtbase/6.3)
Description
This bug is related to QTBUG-104003 and QTBUG-104380.
QExpandingLineEdit::resizeToContents crashes conditionally in qBound (since Qt 6.3.0). Reason is (among others) the added Q_ASSERT in qBound:
constexpr inline const T &qBound(const T &min, const T &val, const T &max) { Q_ASSERT(!(max < min)); // <====== return qMax(min, qMin(max, val)); }
void QExpandingLineEdit::resizeToContents() { int oldWidth = width(); if (originalWidth == -1) originalWidth = oldWidth; if (QWidget *parent = parentWidget()) { QPoint position = pos(); int hintWidth = minimumWidth() + fontMetrics().horizontalAdvance(displayText()); int parentWidth = parent->width(); int maxWidth = isRightToLeft() ? position.x() + oldWidth : parentWidth - position.x(); int newWidth = qBound(originalWidth, hintWidth, maxWidth); // <===== if (widgetOwnsGeometry) setMaximumWidth(newWidth); if (isRightToLeft()) move(position.x() - newWidth + oldWidth, position.y()); resize(newWidth, height()); } }
The bug is reproducable with the attached qtbug_dirview.zip (nearly identical to qtbase/examples/widgets/itemviews/dirview/main.cpp).
- Select an editable file name.
- Reduceb the width of the window, so that the width is less than the width of column 'Name'.
- Press 'F2'.
Error message:
ASSERT: "!(max < min)" in file /dataext/qt/qtbase/src/corelib/global/qglobal.h, line 1025
Call stack:
#0 0x00007ffff4c44cdb in raise () from /lib64/libc.so.6 #1 0x00007ffff4c46375 in abort () from /lib64/libc.so.6 #2 0x00007ffff6088bcd in qAbort () at /dataext/qt/qtbase/src/corelib/global/qglobal.cpp:3397 #3 0x00007ffff6092ca3 in qt_message_fatal (context=..., message="ASSERT: \"!(max < min)\" in file /dataext/qt/qtbase/src/corelib/global/qglobal.h, line 1025") at /dataext/qt/qtbase/src/corelib/global/qlogging.cpp:1881 #4 0x00007ffff609558f in QMessageLogger::fatal (this=this@entry=0x7fffffffb770, msg=msg@entry=0x7ffff644fc88 "ASSERT: \"%s\" in file %s, line %d") at /dataext/qt/qtbase/src/corelib/global/qlogging.cpp:881 #5 0x00007ffff6088452 in qt_assert (assertion=assertion@entry=0x7ffff7a00b70 "!(max < min)", file=file@entry=0x7ffff7a00b08 "/dataext/qt/qtbase/src/corelib/global/qglobal.h", line=line@entry=1025) at /dataext/qt/qtbase/src/corelib/global/qglobal.cpp:3304 #6 0x00007ffff78813ab in qBound<int> (max=@0x7fffffffb7b4: 292, val=@0x7fffffffb7b0: 38, min=@0x907b78: 849) at /dataext/qt/qtbase/src/corelib/global/qglobal.h:1025 #7 QExpandingLineEdit::resizeToContents (this=this@entry=0x907b50) at /dataext/qt/qtbase/src/widgets/itemviews/qitemeditorfactory.cpp:594 #8 0x00007ffff788143d in QExpandingLineEdit::qt_static_metacall (_o=0x907b50, _c=<optimized out>, _id=0, _a=<optimized out>) at qtbase/src/widgets/Widgets_autogen/include/moc_qitemeditorfactory_p.cpp:71 #9 0x00007ffff61856bc in doActivate<false> (sender=sender@entry=0x907b50, signal_index=7, argv=0x7fffffffb920) at /dataext/qt/qtbase/src/corelib/kernel/qobject.cpp:3931 #10 0x00007ffff617b9a9 in QMetaObject::activate (sender=sender@entry=0x907b50, m=m@entry=0x7ffff7da1aa0 <QLineEdit::staticMetaObject>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x7fffffffb920) at /dataext/qt/qtbase/src/corelib/kernel/qobject.cpp:3979 #11 0x00007ffff76b8ea4 in QLineEdit::textChanged (this=this@entry=0x907b50, _t1=...) at qtbase/src/widgets/Widgets_autogen/include/moc_qlineedit.cpp:429 #12 0x00007ffff76c1476 in QLineEdit::qt_static_metacall (_o=0x907b50, _c=<optimized out>, _id=0, _a=0x7fffffffbb30) at qtbase/src/widgets/Widgets_autogen/include/moc_qlineedit.cpp:236 #13 0x00007ffff61856bc in doActivate<false> (sender=sender@entry=0x8e9790, signal_index=6, argv=0x7fffffffbb30) at /dataext/qt/qtbase/src/corelib/kernel/qobject.cpp:3931 #14 0x00007ffff617b9a9 in QMetaObject::activate (sender=sender@entry=0x8e9790, m=m@entry=0x7ffff7da1de0 <QWidgetLineControl::staticMetaObject>, local_signal_index=local_signal_index@entry=3, argv=argv@entry=0x7fffffffbb30) at /dataext/qt/qtbase/src/corelib/kernel/qobject.cpp:3979 #15 0x00007ffff76c69d8 in QWidgetLineControl::textChanged (this=this@entry=0x8e9790, _t1="y.cpp") at qtbase/src/widgets/Widgets_autogen/include/moc_qwidgetlinecontrol_p.cpp:277 #16 0x00007ffff76ca43c in QWidgetLineControl::finishChange (this=this@entry=0x8e9790, validateFromState=validateFromState@entry=-1, update=update@entry=true, edited=edited@entry=false) at /dataext/qt/qtbase/src/widgets/widgets/qwidgetlinecontrol.cpp:750 #17 0x00007ffff76ca789 in QWidgetLineControl::internalSetText (this=this@entry=0x8e9790, txt="y.cpp", pos=pos@entry=-1, edited=edited@entry=false) at /dataext/qt/qtbase/src/widgets/widgets/qwidgetlinecontrol.cpp:786 #18 0x00007ffff76c3fc2 in QWidgetLineControl::setText (txt="y.cpp", this=0x8e9790) at qtbase/include/QtWidgets/6.3.0/QtWidgets/private/../../../../../../../qt/qtbase/src/widgets/widgets/qwidgetlinecontrol_p.h:253 #19 QLineEditPrivate::setText (this=<optimized out>, text="y.cpp") at /dataext/qt/qtbase/src/widgets/widgets/qlineedit_p.cpp:289 #20 0x00007ffff76b9d07 in QLineEdit::setText (this=this@entry=0x907b50, text=...) at /dataext/qt/qtbase/src/widgets/widgets/qlineedit.cpp:319 #21 0x00007ffff76c1e0e in QLineEdit::qt_static_metacall (_o=_o@entry=0x907b50, _c=_c@entry=QMetaObject::WriteProperty, _id=_id@entry=1, _a=_a@entry=0x7fffffffbf50) at qtbase/src/widgets/Widgets_autogen/include/moc_qlineedit.cpp:351 #22 0x00007ffff76c22b6 in QLineEdit::qt_metacall (this=this@entry=0x907b50, _c=_c@entry=QMetaObject::WriteProperty, _id=1, _a=_a@entry=0x7fffffffbf50) at qtbase/src/widgets/Widgets_autogen/include/moc_qlineedit.cpp:418 #23 0x00007ffff7882e0b in QExpandingLineEdit::qt_metacall (this=0x907b50, _c=QMetaObject::WriteProperty, _id=<optimized out>, _a=0x7fffffffbf50) at qtbase/src/widgets/Widgets_autogen/include/moc_qitemeditorfactory_p.cpp:109 #24 0x00007ffff612a716 in QMetaObject::metacall (object=object@entry=0x907b50, cl=cl@entry=QMetaObject::WriteProperty, idx=<optimized out>, argv=argv@entry=0x7fffffffbf50) at /dataext/qt/qtbase/src/corelib/kernel/qmetaobject.cpp:322 #25 0x00007ffff6130fa0 in QMetaProperty::write (this=this@entry=0x7fffffffc080, object=object@entry=0x907b50, value=Python Exception <class 'gdb.error'>: Cannot take address of method type. ) at /dataext/qt/qtbase/src/corelib/kernel/qmetaobject.cpp:3331 #26 0x00007ffff618384a in QObject::setProperty (this=this@entry=0x907b50, name=<optimized out>, value=Python Exception <class 'gdb.error'>: Cannot take address of method type. ) at /dataext/qt/qtbase/src/corelib/kernel/qobject.cpp:4103 #27 0x00007ffff78852a2 in QStyledItemDelegate::setEditorData (this=<optimized out>, editor=0x907b50, index=...) at /dataext/qt/qtbase/src/widgets/itemviews/qstyleditemdelegate.cpp:471 #28 0x00007ffff784dfdb in QAbstractItemViewPrivate::editor (this=this@entry=0x699080, index=..., options=...) at /dataext/qt/qtbase/src/widgets/itemviews/qabstractitemview.cpp:4416 #29 0x00007ffff784e0de in QAbstractItemViewPrivate::openEditor (this=this@entry=0x699080, index=..., event=event@entry=0x0) at /dataext/qt/qtbase/src/widgets/itemviews/qabstractitemview.cpp:4586 #30 0x00007ffff784e48b in QAbstractItemView::edit (this=0x7fffffffc450, this@entry=0x7fffffffd7a0, index=..., trigger=trigger@entry=QAbstractItemView::EditKeyPressed, event=event@entry=0x7fffffffd3d0) at /dataext/qt/qtbase/src/widgets/itemviews/qabstractitemview.cpp:2801 #31 0x00007ffff78491f0 in QAbstractItemView::keyPressEvent (this=this@entry=0x7fffffffd7a0, event=event@entry=0x7fffffffd3d0) at /dataext/qt/qtbase/src/widgets/itemviews/qabstractitemview.cpp:2533 #32 0x00007ffff78eec4c in QTreeView::keyPressEvent (this=0x7fffffffd7a0, event=0x7fffffffd3d0) at /dataext/qt/qtbase/src/widgets/itemviews/qtreeview.cpp:2051 #33 0x00007ffff754730b in QWidget::event (this=this@entry=0x7fffffffd7a0, event=event@entry=0x7fffffffd3d0) at /dataext/qt/qtbase/src/widgets/kernel/qwidget.cpp:8853 #34 0x00007ffff760561e in QFrame::event (this=this@entry=0x7fffffffd7a0, e=e@entry=0x7fffffffd3d0) at /dataext/qt/qtbase/src/widgets/widgets/qframe.cpp:550 #35 0x00007ffff760282c in QAbstractScrollArea::event (this=this@entry=0x7fffffffd7a0, e=e@entry=0x7fffffffd3d0) at /dataext/qt/qtbase/src/widgets/widgets/qabstractscrollarea.cpp:1044 #36 0x00007ffff7852271 in QAbstractItemView::event (this=0x7fffffffd7a0, event=0x7fffffffd3d0) at /dataext/qt/qtbase/src/widgets/itemviews/qabstractitemview.cpp:1720 #37 0x00007ffff74dad61 in QApplicationPrivate::notify_helper (this=this@entry=0x6301b0, receiver=receiver@entry=0x7fffffffd7a0, e=e@entry=0x7fffffffd3d0) at /dataext/qt/qtbase/src/widgets/kernel/qapplication.cpp:3337 #38 0x00007ffff74e4226 in QApplication::notify (this=<optimized out>, receiver=<optimized out>, e=0x7fffffffd3d0) at /dataext/qt/qtbase/src/widgets/kernel/qapplication.cpp:2767 #39 0x00007ffff6119f1c in QCoreApplication::notifyInternal2 (receiver=0x7fffffffd7a0, event=0x7fffffffd3d0) at /dataext/qt/qtbase/src/corelib/kernel/qcoreapplication.cpp:1068 #40 0x00007ffff6119f6e in QCoreApplication::forwardEvent (receiver=receiver@entry=0x7fffffffd7a0, event=event@entry=0x7fffffffd3d0, originatingEvent=originatingEvent@entry=0x0) at /dataext/qt/qtbase/src/corelib/kernel/qcoreapplication.cpp:1083 #41 0x00007ffff755e2e8 in QWidgetWindow::handleKeyEvent (this=this@entry=0x72df90, event=event@entry=0x7fffffffd3d0) at /dataext/qt/qtbase/src/widgets/kernel/qwidgetwindow.cpp:707 #42 0x00007ffff7563257 in QWidgetWindow::event (this=0x72df90, event=0x7fffffffd3d0) at /dataext/qt/qtbase/src/widgets/kernel/qwidgetwindow.cpp:278 #43 0x00007ffff74dad61 in QApplicationPrivate::notify_helper (this=this@entry=0x6301b0, receiver=receiver@entry=0x72df90, e=e@entry=0x7fffffffd3d0) at /dataext/qt/qtbase/src/widgets/kernel/qapplication.cpp:3337 #44 0x00007ffff74e5d1c in QApplication::notify (this=0x7fffffffd820, receiver=0x72df90, e=0x7fffffffd3d0) at /dataext/qt/qtbase/src/widgets/kernel/qapplication.cpp:3288 #45 0x00007ffff6119f1c in QCoreApplication::notifyInternal2 (receiver=receiver@entry=0x72df90, event=event@entry=0x7fffffffd3d0) at /dataext/qt/qtbase/src/corelib/kernel/qcoreapplication.cpp:1068 #46 0x00007ffff6119fe5 in QCoreApplication::sendSpontaneousEvent (receiver=receiver@entry=0x72df90, event=event@entry=0x7fffffffd3d0) at /dataext/qt/qtbase/src/corelib/kernel/qcoreapplication.cpp:1498 #47 0x00007ffff6a28c89 in QGuiApplicationPrivate::processKeyEvent (e=e@entry=0x910500) at /dataext/qt/qtbase/src/gui/kernel/qguiapplication.cpp:2380 #48 0x00007ffff6a2a4cb in QGuiApplicationPrivate::processWindowSystemEvent (e=e@entry=0x910500) at /dataext/qt/qtbase/src/gui/kernel/qguiapplication.cpp:2010 #49 0x00007ffff6a86b58 in QWindowSystemInterface::sendWindowSystemEvents (flags=flags@entry=...) at /dataext/qt/qtbase/src/gui/kernel/qwindowsysteminterface.cpp:1135 #50 0x00007fffeeefe195 in xcbSourceDispatch (source=<optimized out>) at /dataext/qt/qtbase/src/plugins/platforms/xcb/qxcbeventdispatcher.cpp:93 #51 0x00007ffff3d3b7fb in g_main_context_dispatch () from /usr/lib64/libglib-2.0.so.0 #52 0x00007ffff3d3bba0 in ?? () from /usr/lib64/libglib-2.0.so.0 #53 0x00007ffff3d3bc2c in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0 #54 0x00007ffff640d79b in QEventDispatcherGlib::processEvents (this=0x68c430, flags=...) at /dataext/qt/qtbase/src/corelib/kernel/qeventdispatcher_glib.cpp:429 #55 0x00007fffeeefe4b8 in QXcbGlibEventDispatcher::processEvents (this=<optimized out>, flags=...) at /dataext/qt/qtbase/src/plugins/platforms/xcb/qxcbeventdispatcher.cpp:132 #56 0x00007ffff612806b in QEventLoop::processEvents (this=this@entry=0x7fffffffd720, flags=..., flags@entry=...) at /dataext/qt/qtbase/src/corelib/kernel/qeventloop.cpp:136 #57 0x00007ffff6128727 in QEventLoop::exec (this=this@entry=0x7fffffffd720, flags=flags@entry=...) at /dataext/qt/qtbase/src/corelib/global/qflags.h:70 #58 0x00007ffff61209a6 in QCoreApplication::exec () at /dataext/qt/qtbase/src/corelib/global/qflags.h:110 #59 0x00007ffff6a1a9c2 in QGuiApplication::exec () at /dataext/qt/qtbase/src/gui/kernel/qguiapplication.cpp:1865 #60 0x00007ffff74dacd3 in QApplication::exec () at /dataext/qt/qtbase/src/widgets/kernel/qapplication.cpp:2618 #61 0x0000000000402375 in main (argc=1, argv=0x7fffffffdbc8) at main.cpp:109
Attachments
Issue Links
- is duplicated by
-
QTBUG-105263 QHeaderView::ResizeToContents causes crash when editing long items
-
- Closed
-
- relates to
-
QTBUG-104565 QTableWidgets: crash when double click into table cell end that expands beyond window
-
- Closed
-
For Gerrit Dashboard: QTBUG-104383 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
418539,5 | Don't trigger qBound assert in QExpandingLineEdit | dev | qt/qtbase | Status: MERGED | +2 | 0 |
419330,2 | Don't trigger qBound assert in QExpandingLineEdit | 6.4 | qt/qtbase | Status: MERGED | +2 | 0 |
419331,2 | Don't trigger qBound assert in QExpandingLineEdit | 6.3 | qt/qtbase | Status: MERGED | +2 | 0 |
419335,2 | Don't trigger qBound assert in QExpandingLineEdit | tqtc/lts-6.2 | qt/tqtc-qtbase | Status: MERGED | +2 | 0 |