Bug 399753 - k3b-18.08.2 assertion on startup: "first <= rowCount(parent)" in file itemmodels/qabstractitemmodel.cpp, line 2712
Summary: k3b-18.08.2 assertion on startup: "first <= rowCount(parent)" in file itemmod...
Status: RESOLVED FIXED
Alias: None
Product: k3b
Classification: Applications
Component: GUI/Usability (show other bugs)
Version: 18.08.1
Platform: Gentoo Packages Linux
: NOR grave
Target Milestone: ---
Assignee: k3b developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-10-13 11:47 UTC by Jaak Ristioja
Modified: 2018-10-15 20:47 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jaak Ristioja 2018-10-13 11:47:07 UTC
SUMMARY

Crashes on startup.


STEPS TO REPRODUCE
1.  Start K3b

OBSERVED RESULT

Doesn't start.


EXPECTED RESULT

Starts up properly.


SOFTWARE VERSIONS
(available in About System)
KDE Plasma Version: 5.13.5
KDE Frameworks Version: 5.50.0
Qt Version: 5.11.1

ADDITIONAL INFORMATION

[New Thread 0x7fffdf287700 (LWP 5145)]
[New Thread 0x7fffdd0b0700 (LWP 5147)]
[New Thread 0x7fffce62d700 (LWP 5148)]
21 21
ASSERT: "first <= rowCount(parent)" in file itemmodels/qabstractitemmodel.cpp, line 2712

Thread 1 "k3b" received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
51      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1  0x00007ffff1cd2f6f in __GI_abort () at abort.c:90
#2  0x00007ffff24ef5c5 in qt_message_fatal (context=..., message=<synthetic pointer>...) at global/qlogging.cpp:1842
#3  QMessageLogger::fatal (this=this@entry=0x7fffffffcdc0, msg=msg@entry=0x7ffff27cfb30 "ASSERT: \"%s\" in file %s, line %d") at global/qlogging.cpp:880
#4  0x00007ffff24eed75 in qt_assert (assertion=assertion@entry=0x7ffff2890d4d "first <= rowCount(parent)", file=file@entry=0x7ffff2890a10 "itemmodels/qabstractitemmodel.cpp", line=line@entry=2712) at global/qglobal.cpp:3188
#5  0x00007ffff26a4e14 in QAbstractItemModel::beginInsertRows (this=this@entry=0x555555b2ffd0, parent=..., first=first@entry=1, last=last@entry=1) at itemmodels/qabstractitemmodel.cpp:2712
#6  0x00005555555d65e9 in K3b::MetaItemModel::addSubModel (this=0x555555b2ffd0, name=..., icon=..., model=0x555555d95900, flat=<optimized out>) at /var/tmp/portage/kde-apps/k3b-18.08.2/work/k3b-18.08.2/src/k3bmetaitemmodel.cpp:739
#7  0x00005555555dd611 in K3b::PlacesModel::addPlace (this=this@entry=0x555555b2ffd0, name=..., icon=..., rootUrl=...) at /var/tmp/portage/kde-apps/k3b-18.08.2/work/k3b-18.08.2/src/k3bplacesmodel.cpp:177
#8  0x00005555555dd8ae in K3b::PlacesModel::PlacesModel (this=0x555555b2ffd0, parent=<optimized out>) at /var/tmp/portage/kde-apps/k3b-18.08.2/work/k3b-18.08.2/src/k3bplacesmodel.cpp:62
#9  0x00005555555df493 in K3b::FileTreeView::FileTreeView (this=0x555555c63d40, parent=<optimized out>) at /var/tmp/portage/kde-apps/k3b-18.08.2/work/k3b-18.08.2/src/k3bfiletreeview.cpp:72
#10 0x00005555555ea8f1 in K3b::MainWindow::initView (this=this@entry=0x5555559e48b0) at /var/tmp/portage/kde-apps/k3b-18.08.2/work/k3b-18.08.2/src/k3b.cpp:522
#11 0x00005555555eb410 in K3b::MainWindow::MainWindow (this=0x5555559e48b0, __in_chrg=<optimized out>, __vtt_parm=<optimized out>) at /var/tmp/portage/kde-apps/k3b-18.08.2/work/k3b-18.08.2/src/k3b.cpp:237
#12 0x00005555555ce4b4 in K3b::Application::init (this=0x7fffffffd250, commandLineParser=<optimized out>) at /var/tmp/portage/kde-apps/k3b-18.08.2/work/k3b-18.08.2/src/k3bapplication.cpp:84
#13 0x00005555555ca0a3 in main (argc=<optimized out>, argv=<optimized out>) at /var/tmp/portage/kde-apps/k3b-18.08.2/work/k3b-18.08.2/src/main.cpp:141
(gdb) bt full
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
        set = {__val = {0, 140737488342048, 140737488342048, 140737258876986, 272, 8, 0, 17650251434217378048, 88, 140737488342048, 140737488342048, 17650251434217378048, 140737488342048, 140737253893344, 140737253893792, 93824998375376}}
        pid = <optimized out>
        tid = <optimized out>
        ret = <optimized out>
#1  0x00007ffff1cd2f6f in __GI_abort () at abort.c:90
        save_stage = 2
        act = {__sigaction_handler = {sa_handler = 0x555555d97f80, sa_sigaction = 0x555555d97f80}, sa_mask = {__val = {17650251434217378048, 140737488342464, 140737488342232, 3, 140737258754524, 93825000967152, 17650251434217378048, 0, 17650251434217378048, 140737488342464, 140737488342232, 3, 140737488342464, 93824998375376, 140737258755016, 140737431774131}}, sa_flags = 349901056, sa_restorer = 0x7fffffffccd8}
        sigs = {__val = {32, 0 <repeats 15 times>}}
#2  0x00007ffff24ef5c5 in qt_message_fatal (context=..., message=<synthetic pointer>...) at global/qlogging.cpp:1842
No locals.
#3  QMessageLogger::fatal (this=this@entry=0x7fffffffcdc0, msg=msg@entry=0x7ffff27cfb30 "ASSERT: \"%s\" in file %s, line %d") at global/qlogging.cpp:880
        message = <optimized out>
        ap = {{gp_offset = 40, fp_offset = 48, overflow_arg_area = 0x7fffffffcdc0, reg_save_area = 0x7fffffffcd00}}
#4  0x00007ffff24eed75 in qt_assert (assertion=assertion@entry=0x7ffff2890d4d "first <= rowCount(parent)", file=file@entry=0x7ffff2890a10 "itemmodels/qabstractitemmodel.cpp", line=line@entry=2712) at global/qglobal.cpp:3188
No locals.
#5  0x00007ffff26a4e14 in QAbstractItemModel::beginInsertRows (this=this@entry=0x555555b2ffd0, parent=..., first=first@entry=1, last=last@entry=1) at itemmodels/qabstractitemmodel.cpp:2712
        d = <optimized out>
#6  0x00005555555d65e9 in K3b::MetaItemModel::addSubModel (this=0x555555b2ffd0, name=..., icon=..., model=0x555555d95900, flat=<optimized out>) at /var/tmp/portage/kde-apps/k3b-18.08.2/work/k3b-18.08.2/src/k3bmetaitemmodel.cpp:739
        first = <optimized out>
        last = 1
        place = <optimized out>
#7  0x00005555555dd611 in K3b::PlacesModel::addPlace (this=this@entry=0x555555b2ffd0, name=..., icon=..., rootUrl=...) at /var/tmp/portage/kde-apps/k3b-18.08.2/work/k3b-18.08.2/src/k3bplacesmodel.cpp:177
        model = 0x555555d98ad0
        proxy = 0x555555d95900
#8  0x00005555555dd8ae in K3b::PlacesModel::PlacesModel (this=0x555555b2ffd0, parent=<optimized out>) at /var/tmp/portage/kde-apps/k3b-18.08.2/work/k3b-18.08.2/src/k3bplacesmodel.cpp:62
        place = {r = 0, c = 0, i = 93825000928672, m = 0x555555d82830}
        url = {d = 0x555555d9c730}
        i = 0
        i = <optimized out>
        place = <optimized out>
        url = <optimized out>
#9  0x00005555555df493 in K3b::FileTreeView::FileTreeView (this=0x555555c63d40, parent=<optimized out>) at /var/tmp/portage/kde-apps/k3b-18.08.2/work/k3b-18.08.2/src/k3bfiletreeview.cpp:72
        delegate = <optimized out>
        delegate = <optimized out>
#10 0x00005555555ea8f1 in K3b::MainWindow::initView (this=this@entry=0x5555559e48b0) at /var/tmp/portage/kde-apps/k3b-18.08.2/work/k3b-18.08.2/src/k3b.cpp:522
        upperSplitter = 0x555555d20640
        documentHullLayout = <optimized out>
        fileTreeView = <optimized out>
        urlNavigatorAction = <optimized out>
#11 0x00005555555eb410 in K3b::MainWindow::MainWindow (this=0x5555559e48b0, __in_chrg=<optimized out>, __vtt_parm=<optimized out>) at /var/tmp/portage/kde-apps/k3b-18.08.2/work/k3b-18.08.2/src/k3b.cpp:237
        grp = {<KConfigBase> = {_vptr.KConfigBase = 0x555555b6b0e0}, d = {d = 0x7fffffffd160}}
        grp = <optimized out>
#12 0x00005555555ce4b4 in K3b::Application::init (this=0x7fffffffd250, commandLineParser=<optimized out>) at /var/tmp/portage/kde-apps/k3b-18.08.2/work/k3b-18.08.2/src/k3bapplication.cpp:84
        generalOptions = {<KConfigBase> = {_vptr.KConfigBase = 0x7ffff496a460 <vtable for KConfigGroup+16>}, d = {d = 0x555555a962a0}}
        splash = 0x555555ac8620
#13 0x00005555555ca0a3 in main (argc=<optimized out>, argv=<optimized out>) at /var/tmp/portage/kde-apps/k3b-18.08.2/work/k3b-18.08.2/src/main.cpp:141
        app = {<QApplication> = {<QGuiApplication> = {<QCoreApplication> = {<QObject> = {_vptr.QObject = 0x5555559b0280 <vtable for K3b::Application+16>, static staticMetaObject = {d = {superdata = 0x0, stringdata = 0x7ffff28a29e0 <qt_meta_stringdata_QObject>, data = 0x7ffff28a28c0 <qt_meta_data_QObject>, static_metacall = 0x7ffff2730540 <QObject::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}, d_ptr = {d = 0x5555559e1270}, static staticQtMetaObject = {d = {superdata = 0x0, stringdata = 0x7ffff28a57a0 <qt_meta_stringdata_Qt>, data = 0x7ffff28a2b00 <qt_meta_data_Qt>, static_metacall = 0x0, relatedMetaObjects = 0x0, extradata = 0x0}}}, static staticMetaObject = {d = {superdata = 0x7ffff2b9a0e0 <QObject::staticMetaObject>, stringdata = 0x7ffff289bfe0 <qt_meta_stringdata_QCoreApplication>, data = 0x7ffff289bec0 <qt_meta_data_QCoreApplication>, static_metacall = 0x7ffff26f6c80 <QCoreApplication::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}, static self = 0x7fffffffd250}, static staticMetaObject = {d = {superdata = 0x7ffff2ba1c00 <QCoreApplication::staticMetaObject>, stringdata = 0x7ffff32f3180 <qt_meta_stringdata_QGuiApplication>, data = 0x7ffff32f2f00 <qt_meta_data_QGuiApplication>, static_metacall = 0x7ffff2f63b70 <QGuiApplication::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}}, static staticMetaObject = {d = {superdata = 0x7ffff35dbf40 <QGuiApplication::staticMetaObject>, stringdata = 0x7ffff3b30b00 <qt_meta_stringdata_QApplication>, data = 0x7ffff3b30980 <qt_meta_data_QApplication>, static_metacall = 0x7ffff3752880 <QApplication::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}}, static staticMetaObject = {d = {superdata = 0x7ffff3e8d520 <QApplication::staticMetaObject>, stringdata = 0x555555774ec0 <qt_meta_stringdata_K3b__Application>, data = 0x555555774e20 <qt_meta_data_K3b__Application>, static_metacall = 0x55555572a7f0 <K3b::Application::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}, m_cmdLine = {d = 0x555555a9c0c0}, m_core = 0x555555ac7110, m_mainWindow = 0x0}
        aboutData = {d = 0x555555a59770}
        parser = 0x555555a9c0c0
Comment 1 Jaak Ristioja 2018-10-13 12:01:00 UTC
The following Qt commit apparently added this assertion to QAbstractItemModel::beginInsertRows:

https://code.qt.io/cgit/qt/qtbase.git/commit/src/corelib/itemmodels/qabstractitemmodel.cpp?id=00c09e752ff7e482e1308e0e34721dc979204595
Comment 2 Albert Astals Cid 2018-10-14 22:34:00 UTC
As a side note, unless you're a developer, it's a bad idea to run Qt in debug mode (like you are) since it means things are going to be slower for no "real good reason".

But yes that code looks indeed fishy.
Comment 3 Albert Astals Cid 2018-10-14 22:37:12 UTC
https://phabricator.kde.org/D16213
Comment 4 Albert Astals Cid 2018-10-15 20:47:00 UTC
Git commit 8709a3dcaef941db7467a94cfc77ca68542e2c45 by Albert Astals Cid.
Committed on 14/10/2018 at 22:37.
Pushed by aacid into branch 'Applications/18.08'.

MetaItemModel: Fix Qt assertion in adding rows

Summary:
We need the row count to be correct, and since flat models sometimes have no rows, places.count is not a valid row

Differential Revision: https://phabricator.kde.org/D16213

M  +2    -5    src/k3bmetaitemmodel.cpp

https://commits.kde.org/k3b/8709a3dcaef941db7467a94cfc77ca68542e2c45