Application: kmymoney (4.6.3) KDE Platform Version: 4.8.5 (4.8.5) "release 2" Qt Version: 4.8.1 Operating System: Linux 3.4.11-2.16-desktop x86_64 Distribution: "openSUSE 12.2 (x86_64)" -- Information about the crash: 1) Loaded skeleton .kmy file 2) Imported small QIF file 3) Went to Institutions display and added new institution 4) On Accounts page edited two accounts to belong to the institution (1 checking, 1 investment) 5) On Investments page (Equities tab) selected a security, right click->Edit security 6) Changed type from stock to mutual fund 7) Clicked next, next; when I click on Finish, KMyMoney crashes. The crash can be reproduced every time. -- Backtrace: Application: KMyMoney (kmymoney), signal: Segmentation fault Using host libthread_db library "/lib64/libthread_db.so.1". [KCrash Handler] #5 InstitutionsModel::slotObjectModified (this=0x184a180, objType=<optimized out>, obj=0x42f4f90) at /usr/src/debug/kmymoney-4.6.3/kmymoney/models/accountsmodel.cpp:909 #6 0x00007fd61780af5f in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib64/libQtCore.so.4 #7 0x00007fd61b34cc2e in MyMoneyFile::objectModified (this=this@entry=0x7fd61b5b9ac0 <MyMoneyFile::file>, _t1=MyMoneyFile::notifyAccount, _t2=0x42f4f90) at /usr/src/debug/kmymoney-4.6.3/build/kmymoney/mymoney/mymoneyfile.moc:134 #8 0x00007fd61b3562b9 in MyMoneyFile::commitTransaction (this=this@entry=0x7fd61b5b9ac0 <MyMoneyFile::file>) at /usr/src/debug/kmymoney-4.6.3/kmymoney/mymoney/mymoneyfile.cpp:392 #9 0x00007fd61b356505 in MyMoneyFileTransaction::commit (this=0x7fff5fce7db0) at /usr/src/debug/kmymoney-4.6.3/kmymoney/mymoney/mymoneyfile.cpp:2832 #10 0x00000000005e623a in KNewInvestmentWizard::createObjects (this=<optimized out>, parentId=...) at /usr/src/debug/kmymoney-4.6.3/kmymoney/wizards/newinvestmentwizard/knewinvestmentwizard.cpp:239 #11 0x0000000000469ee3 in KMyMoneyApp::slotInvestmentEdit (this=0x145fb10) at /usr/src/debug/kmymoney-4.6.3/kmymoney/kmymoney.cpp:3130 #12 0x000000000049a4cc in KMyMoneyApp::qt_static_metacall (_o=0x145fb10, _c=1607366704, _id=397715457, _a=0x0) at /usr/src/debug/kmymoney-4.6.3/build/kmymoney/kmymoney.moc:434 #13 0x00007fd61780af5f in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib64/libQtCore.so.4 #14 0x00007fd61691e522 in QAction::triggered(bool) () from /usr/lib64/libQtGui.so.4 #15 0x00007fd61691e710 in QAction::activate(QAction::ActionEvent) () from /usr/lib64/libQtGui.so.4 #16 0x00007fd616d573d3 in ?? () from /usr/lib64/libQtGui.so.4 #17 0x00007fd616d5d6e9 in ?? () from /usr/lib64/libQtGui.so.4 #18 0x00007fd619e95fd0 in KMenu::mouseReleaseEvent(QMouseEvent*) () from /usr/lib64/libkdeui.so.5 #19 0x00007fd616973e60 in QWidget::event(QEvent*) () from /usr/lib64/libQtGui.so.4 #20 0x00007fd616d5e99b in QMenu::event(QEvent*) () from /usr/lib64/libQtGui.so.4 #21 0x00007fd61692474c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib64/libQtGui.so.4 #22 0x00007fd6169294db in QApplication::notify(QObject*, QEvent*) () from /usr/lib64/libQtGui.so.4 #23 0x00007fd619ddd006 in KApplication::notify(QObject*, QEvent*) () from /usr/lib64/libkdeui.so.5 #24 0x00007fd6177f473e in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib64/libQtCore.so.4 #25 0x00007fd61692558b in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) () from /usr/lib64/libQtGui.so.4 #26 0x00007fd61699fa9c in ?? () from /usr/lib64/libQtGui.so.4 #27 0x00007fd61699e961 in QApplication::x11ProcessEvent(_XEvent*) () from /usr/lib64/libQtGui.so.4 #28 0x00007fd6169c4c32 in ?? () from /usr/lib64/libQtGui.so.4 #29 0x00007fd610f273b5 in g_main_context_dispatch () from /usr/lib64/libglib-2.0.so.0 #30 0x00007fd610f276e8 in ?? () from /usr/lib64/libglib-2.0.so.0 #31 0x00007fd610f277a4 in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0 #32 0x00007fd617822936 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQtCore.so.4 #33 0x00007fd6169c48ae in ?? () from /usr/lib64/libQtGui.so.4 #34 0x00007fd6177f373f in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQtCore.so.4 #35 0x00007fd6177f39c8 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQtCore.so.4 #36 0x00007fd616d5b3c5 in QMenu::exec(QPoint const&, QAction*) () from /usr/lib64/libQtGui.so.4 #37 0x000000000046a346 in KMyMoneyApp::showContextMenu (this=this@entry=0x145fb10, containerName=...) at /usr/src/debug/kmymoney-4.6.3/kmymoney/kmymoney.cpp:5764 #38 0x000000000046a428 in KMyMoneyApp::slotShowInvestmentContextMenu (this=0x145fb10) at /usr/src/debug/kmymoney-4.6.3/kmymoney/kmymoney.cpp:5780 #39 0x000000000049aaea in KMyMoneyApp::qt_static_metacall (_o=0x145fb10, _c=1607366704, _id=397715457, _a=0x0) at /usr/src/debug/kmymoney-4.6.3/build/kmymoney/kmymoney.moc:531 #40 0x00007fd61780af5f in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib64/libQtCore.so.4 #41 0x0000000000532a1b in KInvestmentView::slotInvestmentContextMenu (this=0x1b17a10) at /usr/src/debug/kmymoney-4.6.3/kmymoney/views/kinvestmentview.cpp:173 #42 0x0000000000533e11 in KInvestmentView::qt_static_metacall (_o=<optimized out>, _c=<optimized out>, _id=<optimized out>, _a=0x7fff5fceabb0) at /usr/src/debug/kmymoney-4.6.3/build/kmymoney/views/kinvestmentview.moc:96 #43 0x00007fd61780af5f in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib64/libQtCore.so.4 #44 0x00007fd616966f92 in QWidget::customContextMenuRequested(QPoint const&) () from /usr/lib64/libQtGui.so.4 #45 0x00007fd61697463d in QWidget::event(QEvent*) () from /usr/lib64/libQtGui.so.4 #46 0x00007fd616d1dca6 in QFrame::event(QEvent*) () from /usr/lib64/libQtGui.so.4 #47 0x00007fd616e2b343 in QAbstractItemView::viewportEvent(QEvent*) () from /usr/lib64/libQtGui.so.4 #48 0x00007fd616e6e961 in QTreeView::viewportEvent(QEvent*) () from /usr/lib64/libQtGui.so.4 #49 0x00007fd6177f48a6 in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) () from /usr/lib64/libQtCore.so.4 #50 0x00007fd61692471c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib64/libQtGui.so.4 #51 0x00007fd6169291e5 in QApplication::notify(QObject*, QEvent*) () from /usr/lib64/libQtGui.so.4 #52 0x00007fd619ddd006 in KApplication::notify(QObject*, QEvent*) () from /usr/lib64/libkdeui.so.5 #53 0x00007fd6177f473e in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib64/libQtCore.so.4 #54 0x00007fd61699fc31 in ?? () from /usr/lib64/libQtGui.so.4 #55 0x00007fd61699e961 in QApplication::x11ProcessEvent(_XEvent*) () from /usr/lib64/libQtGui.so.4 #56 0x00007fd6169c4c32 in ?? () from /usr/lib64/libQtGui.so.4 #57 0x00007fd610f273b5 in g_main_context_dispatch () from /usr/lib64/libglib-2.0.so.0 #58 0x00007fd610f276e8 in ?? () from /usr/lib64/libglib-2.0.so.0 #59 0x00007fd610f277a4 in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0 #60 0x00007fd617822936 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQtCore.so.4 #61 0x00007fd6169c48ae in ?? () from /usr/lib64/libQtGui.so.4 #62 0x00007fd6177f373f in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQtCore.so.4 #63 0x00007fd6177f39c8 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQtCore.so.4 #64 0x00007fd6177f83a8 in QCoreApplication::exec() () from /usr/lib64/libQtCore.so.4 #65 0x000000000045cf26 in runKMyMoney (splash=splash@entry=0x1407eb0, a=<error reading variable: Unhandled dwarf expression opcode 0xfa>) at /usr/src/debug/kmymoney-4.6.3/kmymoney/main.cpp:282 #66 0x000000000045b6ef in main (argc=1, argv=0x7fff5fcecd18) at /usr/src/debug/kmymoney-4.6.3/kmymoney/main.cpp:181 Possible duplicates by query: bug 305787, bug 296518. Reported using DrKonqi
Same for me, too.
Only need to create new institution and add an Investment account to it. Then, select a security, open to edit, but make no changes. Just Next, Next, Next - > Crash.
I must be doing something wrong here or have a different option setting. I am not able to duplicate this. Not in 4.6.3 nor in master.
(In reply to comment #3) > I must be doing something wrong here or have a different option setting. I > am not able to duplicate this. Not in 4.6.3 nor in master. I just tried a slight variation and it worked. (more than once). If the new institution is created and an existing Investment is edited to belong to that institution, then a new security is created and then edited, all is well. If an existing stock is used, or a new one is created, and then the institution is created and then that existing investment is added to it, and then the existing security is edited (even without changing anything) then a crash ensues, every time. It looks as though the editing of the investment to add the institution does not get applied correctly to an existing stock. A newly created one is set up correctly. So 1 Create new investment account 2 Add a stock to that account 3 Create new institution 4 Add the investment to the institution 5 Edit the stock Next>Next>Next>Crash That seems to do it.
Yes, that does it. The problem is caused during step 4. Within void InstitutionsModel::slotObjectModified() the sequence slotObjectRemoved(MyMoneyFile::notifyAccount, oldAccount.id()); slotObjectAdded(MyMoneyFile::notifyAccount, obj); close to the end of the method is executed. oldAccount and obj reference the investment account created in 1. Step 5 operates on the stock created in step 2 which is somehow not part of the model anymore. Looks like the subordinate equity account gets lost during the call to slotObjectRemoved() in the model as it is not found anymore during step 5.
(In reply to comment #5) > Yes, that does it. The problem is caused during step 4. Within void > InstitutionsModel::slotObjectModified() the sequence > > slotObjectRemoved(MyMoneyFile::notifyAccount, oldAccount.id()); > slotObjectAdded(MyMoneyFile::notifyAccount, obj); > > close to the end of the method is executed. oldAccount and obj reference the > investment account created in 1. Step 5 operates on the stock created in > step 2 which is somehow not part of the model anymore. Looks like the > subordinate equity account gets lost during the call to slotObjectRemoved() > in the model as it is not found anymore during step 5. I though I'd have a Iook at this although I have only a very slight idea of what I am doing here, not having encountered Model/View before. However, via a circuitous route, I've come to the conclusion that the reason why the stock account is not in the model is that it wasn't loaded into it. When the institution is first created, the stock account does get loaded, but later, void InstitutionsModel::slotObjectModified() doesn't reload it. So, I've copied the code from the end of void InstitutionsModel::slotObjectAdded() and added that to the end of void InstitutionsModel::slotObjectModified(), at line 879. /// static_cast<InstitutionsPrivate *>(d)->loadInstitution(this, *account); // create items for all the accounts QList<MyMoneyAccount> list; d->m_file->accountList(list); for (QList<MyMoneyAccount>::ConstIterator it_l = list.constBegin(); it_l != list.constEnd(); ++it_l) { static_cast<InstitutionsPrivate *>(d)->loadInstitution(this, *it_l); } } This seems to work, there is no crash, and Instittutions View shows the investment account and the stock. Any thoughts?
Two points. Firstly, the sentence above the code change should read - So, I've copied the code from the end of void InstitutionsModel::load() and added that to the end of void InstitutionsModel::slotObjectAdded at line 879. Apologies for that. Secondly, while the change I made appeared to do what was needed, it appears to do more than wanted. As stated, the crash does not now happen and the stock does get added to the institution, but a subsequent and unconnected creation of an investment account results in a duplication of the entry for the first investment account just in Institution View, More investigation needed.
It wasn't helpful to load all accounts from file into the model every time the void InstitutionsModel::slotObjectAdded() routine was entered, the line d->m_file->accountList(list); being the cause. I've now revised the patch and the end of void InstitutionsModel::slotObjectAdded() now is - if (!account || account->parentAccountId().isEmpty() || account->isIncomeExpense()) return; static_cast<InstitutionsPrivate *>(d)->loadInstitution(this, *account); QStringList list = account->accountList(); for (QStringList::ConstIterator it_l = list.constBegin(); it_l != list.constEnd(); ++it_l) { const MyMoneyAccount& accnt = d->m_file->account(*it_l); static_cast<InstitutionsPrivate *>(d)->loadInstitution(this, accnt); } } The crash no longer occurs and varying the order of creation of the various institution, investment and stock accounts has not so far produced any problems. Neither has testing with my live file. I'll continue testing, and would appreciate a 'looks OK', or otherwise, before I commit.
Git commit a5371f1e0ad7b42c7cfd1a2790108abbac96a732 by Cristian Oneț. Committed on 15/11/2012 at 20:51. Pushed by conet into branch 'master'. Fix the investment accounts handling in the institutions view. Make the investment accounts the only accounts that are added to their parent in the institutions view. The rest of the accounts are added at the first level because they don't inherit the institution from their parent. Thanks to Allen for working on this. M +15 -1 kmymoney/models/accountsmodel.cpp http://commits.kde.org/kmymoney/a5371f1e0ad7b42c7cfd1a2790108abbac96a732
Git commit f6659597570e3281cbd23449b39782b25c77963d by Cristian Oneț. Committed on 15/11/2012 at 20:51. Pushed by conet into branch '4.6'. Fix the investment accounts handling in the institutions view. Make the investment accounts the only accounts that are added to their parent in the institutions view. The rest of the accounts are added at the first level because they don't inherit the institution from their parent. Thanks to Allen for working on this. (cherry picked from commit a5371f1e0ad7b42c7cfd1a2790108abbac96a732) M +15 -1 kmymoney/models/accountsmodel.cpp http://commits.kde.org/kmymoney/f6659597570e3281cbd23449b39782b25c77963d
(In reply to comment #9) > Git commit a5371f1e0ad7b42c7cfd1a2790108abbac96a732 by Cristian Oneț. > Committed on 15/11/2012 at 20:51. > Pushed by conet into branch 'master'. > > Fix the investment accounts handling in the institutions view. > Make the investment accounts the only accounts that are added > to their parent in the institutions view. The rest of the > accounts are added at the first level because they don't inherit > the institution from their parent. Thanks to Allen for working on > this. > > M +15 -1 kmymoney/models/accountsmodel.cpp > > http://commits.kde.org/kmymoney/a5371f1e0ad7b42c7cfd1a2790108abbac96a732 I'm not sure this is right, I'm afraid. I have a test file with no institutions. There is an existing investment with five stocks below it. All looks correct in Institutions view. If I create a new investment account, isolated, the existing five stocks in the other investment account are all duplicated in Institutions view. The new account looks OK. If I add a stock to it, Institutions view shows it as having two identical stocks. The other investment account, with the duplicated stocks, now has them in triplicate. If I now create a new institution, and add the new investment account, with its apparent duplicate stocks, now only one stock is showing. If I now create another investment account, all existing accounts get another stock., and when I add a stock to it, more get added.
I'll take a look at it.
Git commit e492b20918f569e218b65925b7f758aeef01d865 by Cristian Oneț. Committed on 16/11/2012 at 07:49. Pushed by conet into branch 'master'. Only load the child accounts if there are any, otherwise MyMoneyFile::accountList will return all accounts. M +7 -5 kmymoney/models/accountsmodel.cpp http://commits.kde.org/kmymoney/e492b20918f569e218b65925b7f758aeef01d865
Git commit ff5ec06b2eee8b367a2bbd2a50f5c04de7fa45ee by Cristian Oneț. Committed on 16/11/2012 at 07:49. Pushed by conet into branch '4.6'. Only load the child accounts if there are any, otherwise MyMoneyFile::accountList will return all accounts. (cherry picked from commit e492b20918f569e218b65925b7f758aeef01d865) M +7 -5 kmymoney/models/accountsmodel.cpp http://commits.kde.org/kmymoney/ff5ec06b2eee8b367a2bbd2a50f5c04de7fa45ee
*** Bug 296518 has been marked as a duplicate of this bug. ***
*** Bug 283327 has been marked as a duplicate of this bug. ***
*** Bug 305787 has been marked as a duplicate of this bug. ***