Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.0.0
-
None
-
Ubuntu
-
66d56ad79f6294091a0d8691380edded6844bfc1
Description
Normally, a user would do something like:
color: ListView.isCurrentItem ? "green" : "blue"
to color something based on the current index (without using a highlight).
However, doing something like:
color: index == menuView.currentIndex ? "green" : "blue"
generally works, but will crash if:
- list elements are set by a function and;
- the delegate uses the model data for some condition
See attached qml for details.
Backtrace:
Program received signal SIGSEGV, Segmentation fault. malloc_consolidate (av=<value optimised out>) at malloc.c:5138 5138 malloc.c: No such file or directory. in malloc.c (gdb) bt #0 malloc_consolidate (av=<value optimised out>) at malloc.c:5138 #1 0xb5738afd in _int_malloc (av=<value optimised out>, bytes=<value optimised out>) at malloc.c:4372 #2 0xb573ba6c in _int_realloc (av=<value optimised out>, oldp=0x820c108, oldsize=264, nb=520) at malloc.c:5273 #3 0xb573bf9d in *__GI___libc_realloc (oldmem=0x820c110, bytes=514) at malloc.c:3821 #4 0xb5ae206a in qRealloc (ptr=0x820c110, size=514) at global/qmalloc.cpp:65 #5 0xb5b3d227 in QString::realloc (this=0xbfffe8b8, alloc=248) at tools/qstring.cpp:1345 #6 0xb5b3d887 in QString::append (this=0xbfffe8b8, str=...) at tools/qstring.cpp:1562 #7 0xb5b44a75 in QString::vsprintf (this=0xbfffe918, cformat=0xb5ca05d8 "ASSERT failure in %s: \"%s\", file %s, line %d", ap=0xbfffe980 "c\001") at tools/qstring.cpp:5441 #8 0xb5adddf6 in qt_message (msgType=QtFatalMsg, msg=0xb5ca05d8 "ASSERT failure in %s: \"%s\", file %s, line %d", ap=0xbfffe974 "\005\063\071\267\227\062\071\267\304\062\071\267c\001") at global/qglobal.cpp:2245 #9 0xb5ade227 in qFatal (msg=0xb5ca05d8 "ASSERT failure in %s: \"%s\", file %s, line %d") at global/qglobal.cpp:2432 #10 0xb5add86a in qt_assert_x (where=0xb7393305 "QVector<T>::operator[]", what=0xb7393297 "index out of range", file=0xb73932c4 "../../../qtbase/include/QtCore/../../src/corelib/tools/qvector.h", line=355) at global/qglobal.cpp:1960 #11 0xb72a62c9 in QVector<QDeclarativeChangeSet::Insert>::operator[](int) const () from /home/user/depot/qt/qt5/qtbase/lib/libQtDeclarative.so.5 #12 0xb72a503d in QSGItemViewPrivate::applyModelChanges (this=0x811b078) at items/qsgitemview.cpp:1486 #13 0xb72a48a2 in QSGItemViewPrivate::layout (this=0x811b078) at items/qsgitemview.cpp:1387 #14 0xb72a313e in QSGItemView::updatePolish (this=0x815a328) at items/qsgitemview.cpp:1074 #15 0xb71e54b1 in QSGCanvasPrivate::polishItems (this=0x80dc4b0) at items/qsgcanvas.cpp:370 #16 0xb71ed532 in QSGCanvasRenderLoop::polishItems (this=0x8119248) at items/qsgcanvas_p.h:204 #17 0xb71edd2c in QSGCanvasPlainRenderLoop::paint (this=0x8119240) at items/qsgcanvas.cpp:97 #18 0xb71ee019 in QSGCanvasPlainRenderLoop::event (this=0x8119240, e=0x8208690) at items/qsgcanvas.cpp:147 #19 0xb764fdda in QApplicationPrivate::notify_helper (this=0x809ed78, receiver=0x8119240, e=0x8208690) at kernel/qapplication.cpp:4243 #20 0xb764d727 in QApplication::notify (this=0xbffff36c, receiver=0x8119240, e=0x8208690) at kernel/qapplication.cpp:3638 #21 0xb5c13c58 in QCoreApplication::notifyInternal (this=0xbffff36c, receiver=0x8119240, event=0x8208690) at kernel/qcoreapplication.cpp:826 #22 0xb7ea0219 in QCoreApplication::sendEvent (receiver=0x8119240, event=0x8208690) at ../../../qtbase/include/QtCore/../../src/corelib/kernel/qcoreapplication.h:207 #23 0xb5c14d5a in QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=0, data=0x809e5a8) at kernel/qcoreapplication.cpp:1468 #24 0xb5c14829 in QCoreApplication::sendPostedEvents (receiver=0x0, event_type=0) at kernel/qcoreapplication.cpp:1338 #25 0xb5f03cf6 in QCoreApplication::sendPostedEvents () at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:212 #26 0xb5c4eaba in postEventSourceDispatch (s=0x80aa110) at kernel/qeventdispatcher_glib.cpp:279 #27 0xb55ee5e5 in g_main_context_dispatch () from /lib/libglib-2.0.so.0 #28 0xb55f22d8 in ?? () from /lib/libglib-2.0.so.0 #29 0xb55f24b8 in g_main_context_iteration () from /lib/libglib-2.0.so.0 #30 0xb5c4fb32 in QEventDispatcherGlib::processEvents (this=0x80a3058, flags=...) at kernel/qeventdispatcher_glib.cpp:424 #31 0xb5c10e0f in QEventLoop::processEvents (this=0xbffff2bc, flags=...) at kernel/qeventloop.cpp:149 #32 0xb5c11075 in QEventLoop::exec (this=0xbffff2bc, flags=...) at kernel/qeventloop.cpp:225 #33 0xb5c142c9 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1093 #34 0xb5f118db in QGuiApplication::exec () at kernel/qguiapplication.cpp:451 #35 0xb764d3de in QApplication::exec () at kernel/qapplication.cpp:3517 #36 0x0804daf9 in main (argc=2, argv=0xbffff564) at main.cpp:517