Bug 398136

Summary: kbibtex crashes when editing element
Product: [Applications] KBibTeX Reporter: Cor Blom <cornelis>
Component: GeneralAssignee: Thomas Fischer <fischer>
Status: RESOLVED FIXED    
Severity: crash Keywords: drkonqi
Priority: NOR    
Version: 0.8.1   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In: 0.8.2

Description Cor Blom 2018-09-01 22:00:33 UTC
Application: kbibtex (0.8.1)

Qt Version: 5.9.4
Frameworks Version: 5.45.0
Operating System: Linux 4.12.14-lp150.12.16-default x86_64
Distribution: "openSUSE Leap 15.0"

-- Information about the crash:
- What I was doing when the application crashed:

I open an element to edit. In the editing window, when I click on a following tab, the program disappears. I get this with both webkit and webengine (but only webkit the option to report this bug in plasma).

The crash can be reproduced every time.

-- Backtrace:
Application: KBibTeX (kbibtex), signal: Segmentation fault
Using host libthread_db library "/lib64/libthread_db.so.1".
[Current thread is 1 (Thread 0x7fad87b7ae80 (LWP 771))]

Thread 4 (Thread 0x7fad62f16700 (LWP 775)):
#0  0x00007fad81fed08b in poll () from /lib64/libc.so.6
#1  0x00007fad78bf0109 in ?? () from /usr/lib64/libglib-2.0.so.0
#2  0x00007fad78bf021c in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
#3  0x00007fad8291bc0b in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Core.so.5
#4  0x00007fad828c409a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Core.so.5
#5  0x00007fad826f34da in QThread::exec() () from /usr/lib64/libQt5Core.so.5
#6  0x00007fad809af985 in ?? () from /usr/lib64/libQt5DBus.so.5
#7  0x00007fad826f80ce in ?? () from /usr/lib64/libQt5Core.so.5
#8  0x00007fad7a114559 in start_thread () from /lib64/libpthread.so.0
#9  0x00007fad81ff782f in clone () from /lib64/libc.so.6

Thread 3 (Thread 0x7fad66fff700 (LWP 774)):
#0  0x00007fad81fed08b in poll () from /lib64/libc.so.6
#1  0x00007fad78986387 in ?? () from /usr/lib64/libxcb.so.1
#2  0x00007fad78987faa in xcb_wait_for_event () from /usr/lib64/libxcb.so.1
#3  0x00007fad69738029 in ?? () from /usr/lib64/libQt5XcbQpa.so.5
#4  0x00007fad826f80ce in ?? () from /usr/lib64/libQt5Core.so.5
#5  0x00007fad7a114559 in start_thread () from /lib64/libpthread.so.0
#6  0x00007fad81ff782f in clone () from /lib64/libc.so.6

Thread 2 (Thread 0x7fad6a707700 (LWP 773)):
#0  0x00007fad7a11a89d in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007fad8237570c in std::condition_variable::wait(std::unique_lock<std::mutex>&) () from /usr/lib64/libstdc++.so.6
#2  0x00007fad7f6eb657 in ?? () from /usr/lib64/libQt5WebKit.so.5
#3  0x00007fad7f6eb799 in ?? () from /usr/lib64/libQt5WebKit.so.5
#4  0x00007fad8237b40f in ?? () from /usr/lib64/libstdc++.so.6
#5  0x00007fad7a114559 in start_thread () from /lib64/libpthread.so.0
#6  0x00007fad81ff782f in clone () from /lib64/libc.so.6

Thread 1 (Thread 0x7fad87b7ae80 (LWP 771)):
[KCrash Handler]
#6  0x00007fad82770086 in operator<(QString const&, QString const&) () from /usr/lib64/libQt5Core.so.5
#7  0x00007fad858a20f0 in qMapLessThanKey<QString> (key2=..., key1=...) at /usr/include/qt5/QtCore/qmap.h:71
#8  QMapNode<QString, Value>::lowerBound (akey=..., this=<optimized out>) at /usr/include/qt5/QtCore/qmap.h:155
#9  QMapData<QString, Value>::findNode (this=<optimized out>, akey=...) at /usr/include/qt5/QtCore/qmap.h:287
#10 0x00007fad858a2a8d in QMap<QString, Value>::remove (this=this@entry=0x55f6795e0f50, akey=...) at /usr/include/qt5/QtCore/qmap.h:937
#11 0x00007fad858a0d5b in Entry::remove (this=0x55f6795e0f40, key=...) at /usr/src/debug/kbibtex-0.8.1-lp150.8.1.x86_64/src/data/entry.cpp:174
#12 0x00007fad87542c2d in EntryConfiguredWidget::apply (this=0x55f678f34b90, element=...) at /usr/src/debug/kbibtex-0.8.1-lp150.8.1.x86_64/src/gui/element/elementwidgets.cpp:111
#13 0x00007fad87533a3f in ElementEditor::ElementEditorPrivate::switchTo (futureTab=0x55f67928d450, this=0x55f678feb410) at /usr/src/debug/kbibtex-0.8.1-lp150.8.1.x86_64/src/gui/element/elementeditor.cpp:422
#14 ElementEditor::tabChanged (this=<optimized out>) at /usr/src/debug/kbibtex-0.8.1-lp150.8.1.x86_64/src/gui/element/elementeditor.cpp:591
#15 0x00007fad828f314c in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib64/libQt5Core.so.5
#16 0x00007fad8380f67e in QTabWidget::currentChanged(int) () from /usr/lib64/libQt5Widgets.so.5
#17 0x00007fad8381175f in ?? () from /usr/lib64/libQt5Widgets.so.5
#18 0x00007fad828f304a in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib64/libQt5Core.so.5
#19 0x00007fad837f29ee in QTabBar::currentChanged(int) () from /usr/lib64/libQt5Widgets.so.5
#20 0x00007fad837f6ee7 in QTabBar::setCurrentIndex(int) () from /usr/lib64/libQt5Widgets.so.5
#21 0x00007fad837f93f5 in QTabBar::mousePressEvent(QMouseEvent*) () from /usr/lib64/libQt5Widgets.so.5
#22 0x00007fad836926f9 in QWidget::event(QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#23 0x00007fad837f7a3e in QTabBar::event(QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#24 0x00007fad83655e8c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#25 0x00007fad8365d79f in QApplication::notify(QObject*, QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#26 0x00007fad828c5a88 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib64/libQt5Core.so.5
#27 0x00007fad8365c7ef in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) () from /usr/lib64/libQt5Widgets.so.5
#28 0x00007fad836ac2ab in ?? () from /usr/lib64/libQt5Widgets.so.5
#29 0x00007fad836ae701 in ?? () from /usr/lib64/libQt5Widgets.so.5
#30 0x00007fad83655e8c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#31 0x00007fad8365d244 in QApplication::notify(QObject*, QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#32 0x00007fad828c5a88 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib64/libQt5Core.so.5
#33 0x00007fad82e9718b in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () from /usr/lib64/libQt5Gui.so.5
#34 0x00007fad82e98ac5 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) () from /usr/lib64/libQt5Gui.so.5
#35 0x00007fad82e7165b in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Gui.so.5
#36 0x00007fad697980f0 in ?? () from /usr/lib64/libQt5XcbQpa.so.5
#37 0x00007fad78beff57 in g_main_context_dispatch () from /usr/lib64/libglib-2.0.so.0
#38 0x00007fad78bf0190 in ?? () from /usr/lib64/libglib-2.0.so.0
#39 0x00007fad78bf021c in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
#40 0x00007fad8291bbef in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Core.so.5
#41 0x00007fad828c409a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Core.so.5
#42 0x00007fad8382d257 in QDialog::exec() () from /usr/lib64/libQt5Widgets.so.5
#43 0x00007fad8751e7bf in FileView::editElement (this=0x55f678ef4150, element=...) at /usr/src/debug/kbibtex-0.8.1-lp150.8.1.x86_64/src/gui/file/fileview.cpp:134
#44 0x00007fad58a2865e in QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<QSharedPointer<Element> >, void, bool (FileView::*)(QSharedPointer<Element>)>::call (arg=<optimized out>, o=<optimized out>, f=<optimized out>) at /usr/include/qt5/QtCore/qobjectdefs_impl.h:136
#45 QtPrivate::FunctionPointer<bool (FileView::*)(QSharedPointer<Element>)>::call<QtPrivate::List<QSharedPointer<Element> >, void> (arg=<optimized out>, o=<optimized out>, f=<optimized out>) at /usr/include/qt5/QtCore/qobjectdefs_impl.h:169
#46 QtPrivate::QSlotObject<bool (FileView::*)(QSharedPointer<Element>), QtPrivate::List<QSharedPointer<Element> >, void>::impl (which=<optimized out>, this_=<optimized out>, r=<optimized out>, a=<optimized out>, ret=<optimized out>) at /usr/include/qt5/QtCore/qobject_impl.h:120
#47 0x00007fad828f314c in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib64/libQt5Core.so.5
#48 0x00007fad87584b85 in FileView::elementExecuted (this=this@entry=0x55f678ef4150, _t1=...) at /usr/src/debug/kbibtex-0.8.1-lp150.8.1.x86_64/build/src/gui/kbibtexgui_autogen/O3FNYGJQRT/moc_fileview.cpp:284
#49 0x00007fad8751d5a5 in FileView::itemActivated (this=0x55f678ef4150, index=...) at /usr/src/debug/kbibtex-0.8.1-lp150.8.1.x86_64/src/gui/file/fileview.cpp:286
#50 0x00007fad828f314c in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib64/libQt5Core.so.5
#51 0x00007fad83884945 in QAbstractItemView::doubleClicked(QModelIndex const&) () from /usr/lib64/libQt5Widgets.so.5
#52 0x00007fad838f13d3 in QTreeView::mouseDoubleClickEvent(QMouseEvent*) () from /usr/lib64/libQt5Widgets.so.5
#53 0x00007fad83692669 in QWidget::event(QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#54 0x00007fad8373016e in QFrame::event(QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#55 0x00007fad8388fc9c in QAbstractItemView::viewportEvent(QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#56 0x00007fad838f332c in QTreeView::viewportEvent(QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#57 0x00007fad828c5794 in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) () from /usr/lib64/libQt5Core.so.5
#58 0x00007fad83655e65 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#59 0x00007fad8365d79f in QApplication::notify(QObject*, QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#60 0x00007fad828c5a88 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib64/libQt5Core.so.5
#61 0x00007fad8365c7ef in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) () from /usr/lib64/libQt5Widgets.so.5
#62 0x00007fad836ac2ab in ?? () from /usr/lib64/libQt5Widgets.so.5
#63 0x00007fad836ae701 in ?? () from /usr/lib64/libQt5Widgets.so.5
#64 0x00007fad83655e8c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#65 0x00007fad8365d244 in QApplication::notify(QObject*, QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#66 0x00007fad828c5a88 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib64/libQt5Core.so.5
#67 0x00007fad82e97320 in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () from /usr/lib64/libQt5Gui.so.5
#68 0x00007fad82e98ac5 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) () from /usr/lib64/libQt5Gui.so.5
#69 0x00007fad82e7165b in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Gui.so.5
#70 0x00007fad697980f0 in ?? () from /usr/lib64/libQt5XcbQpa.so.5
#71 0x00007fad78beff57 in g_main_context_dispatch () from /usr/lib64/libglib-2.0.so.0
#72 0x00007fad78bf0190 in ?? () from /usr/lib64/libglib-2.0.so.0
#73 0x00007fad78bf021c in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
#74 0x00007fad8291bbef in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Core.so.5
#75 0x00007fad828c409a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Core.so.5
#76 0x00007fad828cc9e4 in QCoreApplication::exec() () from /usr/lib64/libQt5Core.so.5
#77 0x000055f676ee9b34 in main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/kbibtex-0.8.1-lp150.8.1.x86_64/src/program/program.cpp:123

Possible duplicates by query: bug 332885.

Reported using DrKonqi
Comment 1 Thomas Fischer 2018-09-09 18:28:51 UTC
KBibTeX does not crash for me, but an analysis with Valgrind revealed some invalid memory accesses. This requires some deeper investigation ...


113 errors in context 2069 of 2772:
Thread 1 kbibtex:
Invalid read of size 8
   at 0x145AFB14: operator<(QString const&, QString const&) (in /usr/lib64/libQt5Core.so.5.9.6)
   by 0x9177814: bool qMapLessThanKey<QString>(QString const&, QString const&) (qmap.h:71)
   by 0x917804F: QMapNode<QString, Value>::lowerBound(QString const&) (qmap.h:155)
   by 0x9177AEF: QMapData<QString, Value>::findNode(QString const&) const (qmap.h:287)
   by 0x91772A4: QMap<QString, Value>::remove(QString const&) (qmap.h:937)
   by 0x9175490: Entry::remove(QString const&) (entry.cpp:174)
   by 0x50D7013: EntryConfiguredWidget::apply(QSharedPointer<Element>) const (elementwidgets.cpp:111)
   by 0x50D2990: ElementEditor::ElementEditorPrivate::switchTo(QWidget*) (elementeditor.cpp:422)
   by 0x50CF0C2: ElementEditor::tabChanged() (elementeditor.cpp:591)
   by 0x50D68C0: QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, void (ElementEditor::*)()>::call(void (ElementEditor::*)(), ElementEditor*, void**) (qobjectdefs_impl.h:136)
   by 0x50D61CF: void QtPrivate::FunctionPointer<void (ElementEditor::*)()>::call<QtPrivate::List<>, void>(void (ElementEditor::*)(), ElementEditor*, void**) (qobjectdefs_impl.h:169)
   by 0x50D5784: QtPrivate::QSlotObject<void (ElementEditor::*)(), QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (qobject_impl.h:120)
   by 0x1470B16D: QMetaObject::activate(QObject*, int, int, void**) (in /usr/lib64/libQt5Core.so.5.9.6)
   by 0x138CEC4D: QTabWidget::currentChanged(int) (in /usr/lib64/libQt5Widgets.so.5.9.6)
   by 0x138D1046: ??? (in /usr/lib64/libQt5Widgets.so.5.9.6)
   by 0x1470AE18: QMetaObject::activate(QObject*, int, int, void**) (in /usr/lib64/libQt5Core.so.5.9.6)
   by 0x138B02CD: QTabBar::currentChanged(int) (in /usr/lib64/libQt5Widgets.so.5.9.6)
   by 0x138B4A74: QTabBar::setCurrentIndex(int) (in /usr/lib64/libQt5Widgets.so.5.9.6)
   by 0x138B71AF: QTabBar::mousePressEvent(QMouseEvent*) (in /usr/lib64/libQt5Widgets.so.5.9.6)
   by 0x137419FE: QWidget::event(QEvent*) (in /usr/lib64/libQt5Widgets.so.5.9.6)
   by 0x138B5622: QTabBar::event(QEvent*) (in /usr/lib64/libQt5Widgets.so.5.9.6)
   by 0x13701D6B: QApplicationPrivate::notify_helper(QObject*, QEvent*) (in /usr/lib64/libQt5Widgets.so.5.9.6)
   by 0x1370A436: QApplication::notify(QObject*, QEvent*) (in /usr/lib64/libQt5Widgets.so.5.9.6)
   by 0x146E2259: QCoreApplication::notifyInternal2(QObject*, QEvent*) (in /usr/lib64/libQt5Core.so.5.9.6)
 Address 0x46587998 is 24 bytes inside a block of size 48 free'd
   at 0x4C2E13B: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x1459871A: QMapDataBase::freeNodeAndRebalance(QMapNodeBase*) (in /usr/lib64/libQt5Core.so.5.9.6)
   by 0x9177B8E: QMapData<QString, Value>::deleteNode(QMapNode<QString, Value>*) (qmap.h:280)
   by 0x91772C5: QMap<QString, Value>::remove(QString const&) (qmap.h:938)
   by 0x9175490: Entry::remove(QString const&) (entry.cpp:174)
   by 0x50D7013: EntryConfiguredWidget::apply(QSharedPointer<Element>) const (elementwidgets.cpp:111)
   by 0x50D2990: ElementEditor::ElementEditorPrivate::switchTo(QWidget*) (elementeditor.cpp:422)
   by 0x50CF0C2: ElementEditor::tabChanged() (elementeditor.cpp:591)
   by 0x50D68C0: QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, void (ElementEditor::*)()>::call(void (ElementEditor::*)(), ElementEditor*, void**) (qobjectdefs_impl.h:136)
   by 0x50D61CF: void QtPrivate::FunctionPointer<void (ElementEditor::*)()>::call<QtPrivate::List<>, void>(void (ElementEditor::*)(), ElementEditor*, void**) (qobjectdefs_impl.h:169)
   by 0x50D5784: QtPrivate::QSlotObject<void (ElementEditor::*)(), QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (qobject_impl.h:120)
   by 0x1470B16D: QMetaObject::activate(QObject*, int, int, void**) (in /usr/lib64/libQt5Core.so.5.9.6)
   by 0x138CEC4D: QTabWidget::currentChanged(int) (in /usr/lib64/libQt5Widgets.so.5.9.6)
   by 0x138D1046: ??? (in /usr/lib64/libQt5Widgets.so.5.9.6)
   by 0x1470AE18: QMetaObject::activate(QObject*, int, int, void**) (in /usr/lib64/libQt5Core.so.5.9.6)
   by 0x138B02CD: QTabBar::currentChanged(int) (in /usr/lib64/libQt5Widgets.so.5.9.6)
   by 0x138B4A74: QTabBar::setCurrentIndex(int) (in /usr/lib64/libQt5Widgets.so.5.9.6)
   by 0x138B71AF: QTabBar::mousePressEvent(QMouseEvent*) (in /usr/lib64/libQt5Widgets.so.5.9.6)
   by 0x137419FE: QWidget::event(QEvent*) (in /usr/lib64/libQt5Widgets.so.5.9.6)
   by 0x138B5622: QTabBar::event(QEvent*) (in /usr/lib64/libQt5Widgets.so.5.9.6)
   by 0x13701D6B: QApplicationPrivate::notify_helper(QObject*, QEvent*) (in /usr/lib64/libQt5Widgets.so.5.9.6)
   by 0x1370A436: QApplication::notify(QObject*, QEvent*) (in /usr/lib64/libQt5Widgets.so.5.9.6)
   by 0x146E2259: QCoreApplication::notifyInternal2(QObject*, QEvent*) (in /usr/lib64/libQt5Core.so.5.9.6)
   by 0x13708B5C: QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) (in /usr/lib64/libQt5Widgets.so.5.9.6)
 Block was alloc'd at
   at 0x4C2CF0F: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x145989C0: QMapDataBase::createNode(int, int, QMapNodeBase*, bool) (in /usr/lib64/libQt5Core.so.5.9.6)
   by 0x9177A59: QMapData<QString, Value>::createNode(QString const&, Value const&, QMapNode<QString, Value>*, bool) (qmap.h:225)
   by 0x91770B8: QMap<QString, Value>::insert(QString const&, Value const&) (qmap.h:716)
   by 0x9174EB4: Entry::operator=(Entry const&) (entry.cpp:113)
   by 0x9174CD6: Entry::Entry(Entry const&) (entry.cpp:92)
   by 0x50D1E57: ElementEditor::ElementEditorPrivate::reset(QSharedPointer<Element const>) (elementeditor.cpp:340)
   by 0x50D1C9A: ElementEditor::ElementEditorPrivate::reset() (elementeditor.cpp:322)
   by 0x50CEC41: ElementEditor::setElement(QSharedPointer<Element>, File const*) (elementeditor.cpp:531)
   by 0x50B71CC: FileView::editElement(QSharedPointer<Element>) (fileview.cpp:131)
   by 0x45A35E5B: QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<QSharedPointer<Element> >, void, bool (FileView::*)(QSharedPointer<Element>)>::call(bool (FileView::*)(QSharedPointer<Element>), FileView*, void**) (qobjectdefs_impl.h:136)
   by 0x45A35039: void QtPrivate::FunctionPointer<bool (FileView::*)(QSharedPointer<Element>)>::call<QtPrivate::List<QSharedPointer<Element> >, void>(bool (FileView::*)(QSharedPointer<Element>), FileView*, void**) (qobjectdefs_impl.h:169)
   by 0x45A34090: QtPrivate::QSlotObject<bool (FileView::*)(QSharedPointer<Element>), QtPrivate::List<QSharedPointer<Element> >, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (qobject_impl.h:120)
   by 0x1470B16D: QMetaObject::activate(QObject*, int, int, void**) (in /usr/lib64/libQt5Core.so.5.9.6)
   by 0x512C89F: FileView::elementExecuted(QSharedPointer<Element>) (moc_fileview.cpp:284)
   by 0x50B7D36: FileView::itemActivated(QModelIndex const&) (fileview.cpp:286)
   by 0x50BADCF: QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<QModelIndex const&>, void, void (FileView::*)(QModelIndex const&)>::call(void (FileView::*)(QModelIndex const&), FileView*, void**) (qobjectdefs_impl.h:136)
   by 0x50BA9A6: void QtPrivate::FunctionPointer<void (FileView::*)(QModelIndex const&)>::call<QtPrivate::List<QModelIndex const&>, void>(void (FileView::*)(QModelIndex const&), FileView*, void**) (qobjectdefs_impl.h:169)
   by 0x50BA166: QtPrivate::QSlotObject<void (FileView::*)(QModelIndex const&), QtPrivate::List<QModelIndex const&>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (qobject_impl.h:120)
   by 0x1470B16D: QMetaObject::activate(QObject*, int, int, void**) (in /usr/lib64/libQt5Core.so.5.9.6)
   by 0x13949594: QAbstractItemView::doubleClicked(QModelIndex const&) (in /usr/lib64/libQt5Widgets.so.5.9.6)
   by 0x139BD4F7: QTreeView::mouseDoubleClickEvent(QMouseEvent*) (in /usr/lib64/libQt5Widgets.so.5.9.6)
   by 0x137419B6: QWidget::event(QEvent*) (in /usr/lib64/libQt5Widgets.so.5.9.6)
   by 0x137E6FDD: QFrame::event(QEvent*) (in /usr/lib64/libQt5Widgets.so.5.9.6)
Comment 2 Thomas Fischer 2018-09-11 21:08:48 UTC
I think I have fixed the problem, at least Valgrind no longer reports a memory issue in this context.
Please test and confirm yourself. The code is in my personal clone of the KBibTeX repository, not (yet) in the official one:
https://commits.kde.org/clones/kbibtex/thomasfischer/kbibtex/bddb06c5cec1d5b6e22b
Comment 3 Cor Blom 2018-09-11 22:38:59 UTC
After applying the patch kbibtex works fine and does not crash.

Thanks.
Comment 4 Thomas Fischer 2018-09-12 17:54:23 UTC
Git commit bddb06c5cec1d5b6e22b423f2485825261ad8f49 by Thomas Fischer.
Committed on 11/09/2018 at 21:04.
Pushed by thomasfischer into branch 'kbibtex/0.8'.

Fixing conflict btwn iterating over QMap and removing element

Iterating over a QMap<K,V> object and then for one selected element
stopping the iteration and removing this element using the key, i.e.
QMap<K,V>::remove(key) interferes with the map's internal memory
management and may lead to crashes.

To avoid interference, better to remove the selected element using the
iterator directly, i.e. QMap<K,V>::erase(it).
FIXED-IN: 0.8.2

M  +5    -3    src/data/entry.cpp
M  +1    -0    src/test/CMakeLists.txt

https://commits.kde.org/kbibtex/bddb06c5cec1d5b6e22b423f2485825261ad8f49
Comment 5 Thomas Fischer 2018-09-12 18:09:08 UTC
Git commit 6a7de90d7bbe84be71f7195f513bb78350954265 by Thomas Fischer.
Committed on 12/09/2018 at 18:02.
Pushed by thomasfischer into branch 'master'.

Fixing conflict btwn iterating over QMap and removing element

Iterating over a QMap<K,V> object and then for one selected element
stopping the iteration and removing this element using the key, i.e.
QMap<K,V>::remove(key) interferes with the map's internal memory
management and may lead to crashes.

To avoid interference, better to remove the selected element using the
iterator directly, i.e. QMap<K,V>::erase(it).

M  +5    -3    src/data/entry.cpp
M  +25   -0    src/test/CMakeLists.txt
A  +61   -0    src/test/kbibtexdatatest.cpp     [License: GPL (v2+)]

https://commits.kde.org/kbibtex/6a7de90d7bbe84be71f7195f513bb78350954265