[KBibTeX] [Bug 398136] kbibtex crashes when editing element

2018-09-12 Thread Thomas Fischer
https://bugs.kde.org/show_bug.cgi?id=398136

--- Comment #5 from Thomas Fischer  ---
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 object and then for one selected element
stopping the iteration and removing this element using the key, i.e.
QMap::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::erase(it).

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

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

-- 
You are receiving this mail because:
You are watching all bug changes.

[KBibTeX] [Bug 398136] kbibtex crashes when editing element

2018-09-12 Thread Thomas Fischer
https://bugs.kde.org/show_bug.cgi?id=398136

Thomas Fischer  changed:

   What|Removed |Added

  Latest Commit|bddb06c5cec1d5b6e22b423f248 |https://commits.kde.org/kbi
   |5825261ad8f49   |btex/bddb06c5cec1d5b6e22b42
   ||3f2485825261ad8f49
   Version Fixed In||0.8.2
 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED

--- Comment #4 from Thomas Fischer  ---
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 object and then for one selected element
stopping the iteration and removing this element using the key, i.e.
QMap::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::erase(it).
FIXED-IN: 0.8.2

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

https://commits.kde.org/kbibtex/bddb06c5cec1d5b6e22b423f2485825261ad8f49

-- 
You are receiving this mail because:
You are watching all bug changes.

[KBibTeX] [Bug 398136] kbibtex crashes when editing element

2018-09-11 Thread Cor Blom
https://bugs.kde.org/show_bug.cgi?id=398136

--- Comment #3 from Cor Blom  ---
After applying the patch kbibtex works fine and does not crash.

Thanks.

-- 
You are receiving this mail because:
You are watching all bug changes.

[KBibTeX] [Bug 398136] kbibtex crashes when editing element

2018-09-11 Thread Thomas Fischer
https://bugs.kde.org/show_bug.cgi?id=398136

Thomas Fischer  changed:

   What|Removed |Added

  Latest Commit||bddb06c5cec1d5b6e22b423f248
   ||5825261ad8f49
 Status|CONFIRMED   |ASSIGNED

--- Comment #2 from Thomas Fischer  ---
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

-- 
You are receiving this mail because:
You are watching all bug changes.

[KBibTeX] [Bug 398136] kbibtex crashes when editing element

2018-09-09 Thread Thomas Fischer
https://bugs.kde.org/show_bug.cgi?id=398136

Thomas Fischer  changed:

   What|Removed |Added

 Ever confirmed|0   |1
 Status|UNCONFIRMED |CONFIRMED

--- Comment #1 from Thomas Fischer  ---
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 const&, QString const&)
(qmap.h:71)
   by 0x917804F: QMapNode::lowerBound(QString const&)
(qmap.h:155)
   by 0x9177AEF: QMapData::findNode(QString const&) const
(qmap.h:287)
   by 0x91772A4: QMap::remove(QString const&) (qmap.h:937)
   by 0x9175490: Entry::remove(QString const&) (entry.cpp:174)
   by 0x50D7013: EntryConfiguredWidget::apply(QSharedPointer) 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::List<>, void, void (ElementEditor::*)()>::call(void
(ElementEditor::*)(), ElementEditor*, void**) (qobjectdefs_impl.h:136)
   by 0x50D61CF: void QtPrivate::FunctionPointer::call, void>(void (ElementEditor::*)(),
ElementEditor*, void**) (qobjectdefs_impl.h:169)
   by 0x50D5784: QtPrivate::QSlotObject, 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::deleteNode(QMapNode*) (qmap.h:280)
   by 0x91772C5: QMap::remove(QString const&) (qmap.h:938)
   by 0x9175490: Entry::remove(QString const&) (entry.cpp:174)
   by 0x50D7013: EntryConfiguredWidget::apply(QSharedPointer) 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::List<>, void, void (ElementEditor::*)()>::call(void
(ElementEditor::*)(), ElementEditor*, void**) (qobjectdefs_impl.h:136)
   by 0x50D61CF: void QtPrivate::FunctionPointer::call, void>(void (ElementEditor::*)(),
ElementEditor*, void**) (qobjectdefs_impl.h:169)
   by 0x50D5784: QtPrivate::QSlotObject, 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: