Bug 207354

Summary: Crash creating a new account
Product: [Applications] kmymoney Reporter: Burkhard Lück <lueck>
Component: generalAssignee: KMyMoney Devel Mailing List <kmymoney-devel>
Status: RESOLVED FIXED    
Severity: crash CC: asoliverez, onet.cristian
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Burkhard Lück 2009-09-14 15:47:08 UTC
Application: kmymoney (3.95.0-svn20090511)
KDE Version: 4.3.68 (KDE 4.3.68 (KDE 4.4 >= 20090907)) (Compiled from sources)
Qt Version: 4.5.1
Operating System: Linux 2.6.28-15-generic i686
Distribution: Ubuntu 9.04

What I was doing when the application crashed:
On the first use of kmymoney I want to create an account by using "New account".
kmymoney crashes immediately then.
kdelibs rev 1023298, kmymoney rev 1023303

 -- Backtrace:
Application: xxKMyMoneyxx (kmymoney), signal: Segmentation fault
[Current thread is 0 (LWP 20455)]

Thread 2 (Thread 0xaeb58b90 (LWP 20457)):
#0  0xb7ff8430 in __kernel_vsyscall ()
#1  0xb6481412 in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib/tls/i686/cmov/libpthread.so.0
#2  0xb65110ea in QWaitConditionPrivate::wait (this=0x94ffeb0, time=30000) at thread/qwaitcondition_unix.cpp:85
#3  0xb6510c03 in QWaitCondition::wait (this=0x94ffd90, mutex=0x94ffd8c, time=30000) at thread/qwaitcondition_unix.cpp:159
#4  0xb6503e82 in QThreadPoolThread::run (this=0x8f5a158) at concurrent/qthreadpool.cpp:140
#5  0xb65107df in QThreadPrivate::start (arg=0x8f5a158) at thread/qthread_unix.cpp:189
#6  0xb647d4ff in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
#7  0xb597f49e in clone () from /lib/tls/i686/cmov/libc.so.6

Thread 1 (Thread 0xb4dd8970 (LWP 20455)):
[KCrash Handler]
#6  0xb7f7221f in MyMoneyAccount::fraction (this=0xbfd11478, sec=@0x1) at /home/kdedev/svn/playground/office/kmymoney/kmymoney2/mymoney/mymoneyaccount.cpp:578
#7  0x08238219 in NewAccountWizard::AccountTypePage::slotUpdateCurrency (this=0x9aab508) at /home/kdedev/svn/playground/office/kmymoney/kmymoney2/wizards/newaccountwizard/knewaccountwizard.cpp:522
#8  0x0823bf1f in AccountTypePage (this=0x9aab508, wizard=0x9a8ecc8) at /home/kdedev/svn/playground/office/kmymoney/kmymoney2/wizards/newaccountwizard/knewaccountwizard.cpp:474
#9  0x0824eb10 in Wizard (this=0x9a8ecc8, parent=0x0, name=0x0, modal=<value optimized out>, flags={i = -1076815404})
    at /home/kdedev/svn/playground/office/kmymoney/kmymoney2/wizards/newaccountwizard/knewaccountwizard.cpp:103
#10 0x080a1313 in KMyMoney2App::slotAccountNew (this=0x8aa3998, account=@0xbfd11a18) at /home/kdedev/svn/playground/office/kmymoney/kmymoney2/kmymoney2.cpp:2873
#11 0x080a1c81 in KMyMoney2App::slotAccountNew (this=0x8aa3998) at /home/kdedev/svn/playground/office/kmymoney/kmymoney2/kmymoney2.cpp:2868
#12 0x080da5ff in KMyMoney2App::qt_metacall (this=0x8aa3998, _c=QMetaObject::InvokeMetaMethod, _id=166, _a=0xbfd11ddc) at /home/kdedev/svn/playground/build/office/kmymoney/kmymoney2/kmymoney2.moc:552
#13 0xb661d1f7 in QMetaObject::activate (sender=0x8adf220, from_signal_index=5, to_signal_index=6, argv=0xbfd11ddc) at kernel/qobject.cpp:3117
#14 0xb661d424 in QMetaObject::activate (sender=0x8adf220, m=0xb6453fc8, from_local_signal_index=1, to_local_signal_index=2, argv=0xbfd11ddc) at kernel/qobject.cpp:3214
#15 0xb5c830a2 in QAction::triggered (this=0x8adf220, _t1=false) at .moc/debug-shared/moc_qaction.cpp:236
#16 0xb5c84db0 in QAction::activate (this=0x8adf220, event=QAction::Trigger) at kernel/qaction.cpp:1160
#17 0xb6145e36 in QMenuPrivate::activateCausedStack (this=0x8baaaa8, causedStack=@0xbfd11ec4, action=0x8adf220, action_e=QAction::Trigger, self=true) at widgets/qmenu.cpp:967
#18 0xb614a4da in QMenuPrivate::activateAction (this=0x8baaaa8, action=0x8adf220, action_e=QAction::Trigger, self=true) at widgets/qmenu.cpp:1060
#19 0xb614c1f5 in QMenu::mouseReleaseEvent (this=0x8baa9d0, e=0xbfd12608) at widgets/qmenu.cpp:2254
#20 0xb76095c0 in KMenu::mouseReleaseEvent () from /home/kdedev/kdedev/lib/libkdeui.so.5
#21 0xb5cebd3e in QWidget::event (this=0x8baa9d0, event=0xbfd12608) at kernel/qwidget.cpp:7521
#22 0xb614b5ab in QMenu::event (this=0x8baa9d0, e=0xbfd12608) at widgets/qmenu.cpp:2353
#23 0xb5c8b2ed in QApplicationPrivate::notify_helper (this=0x89e41b8, receiver=0x8baa9d0, e=0xbfd12608) at kernel/qapplication.cpp:4057
#24 0xb5c8bf4d in QApplication::notify (this=0x89e4128, receiver=0x8baa9d0, e=0xbfd12608) at kernel/qapplication.cpp:3759
#25 0xb751821d in KApplication::notify () from /home/kdedev/kdedev/lib/libkdeui.so.5
#26 0xb6606bb7 in QCoreApplication::notifyInternal (this=0x89e4128, receiver=0x8baa9d0, event=0xbfd12608) at kernel/qcoreapplication.cpp:606
#27 0xb70d5a27 in QCoreApplication::sendSpontaneousEvent () from /home/kdedev/qt-copy/lib/libQt3Support.so.4
#28 0xb5c90018 in QApplicationPrivate::sendMouseEvent (receiver=0x8baa9d0, event=0xbfd12608, alienWidget=0x0, nativeWidget=0x8baa9d0, buttonDown=0xb6473da0, lastMouseReceiver=@0xb6473da4)
    at kernel/qapplication.cpp:2925
#29 0xb5d0d44f in QETWidget::translateMouseEvent (this=0x8baa9d0, event=0xbfd13c8c) at kernel/qapplication_x11.cpp:4382
#30 0xb5d0ea23 in QApplication::x11ProcessEvent (this=0x89e4128, event=0xbfd13c8c) at kernel/qapplication_x11.cpp:3444
#31 0xb5d3a89c in x11EventSourceDispatch (s=0x89e73a8, callback=0, user_data=0x0) at kernel/qguieventdispatcher_glib.cpp:146
#32 0xb541db88 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#33 0xb54210eb in ?? () from /usr/lib/libglib-2.0.so.0
#34 0xb5421268 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#35 0xb6635a32 in QEventDispatcherGlib::processEvents (this=0x89c0358, flags={i = -1076806076}) at kernel/qeventdispatcher_glib.cpp:324
#36 0xb5d3a094 in QGuiEventDispatcherGlib::processEvents (this=0x89c0358, flags={i = -1076806028}) at kernel/qguieventdispatcher_glib.cpp:202
#37 0xb6603ba8 in QEventLoop::processEvents (this=0xbfd13f00, flags={i = -1076805952}) at kernel/qeventloop.cpp:149
#38 0xb6603e02 in QEventLoop::exec (this=0xbfd13f00, flags={i = -1076805880}) at kernel/qeventloop.cpp:196
#39 0xb660738f in QCoreApplication::exec () at kernel/qcoreapplication.cpp:888
#40 0xb5c8b006 in QApplication::exec () at kernel/qapplication.cpp:3526
#41 0x0808a1b1 in main (argc=1, argv=0xbfd14364) at /home/kdedev/svn/playground/office/kmymoney/kmymoney2/main.cpp:280

Reported using DrKonqi
Comment 1 Alvaro Soliverez 2009-09-15 02:01:10 UTC
which type of account were you trying to create? That would help us pinpoint the problem.
Comment 2 Burkhard Lück 2009-09-15 07:32:50 UTC
I don't get so far to select a type of account. 

I start a fresh build kmymoney, choose Account -> New account from the menu and kmymoney crashes immediately.
Comment 3 Alvaro Soliverez 2009-09-16 01:25:30 UTC
I can't reproduce it. I created a new file, and didn't create any account during the new user wizard. I then clicked on new account and I was able to create a checking account without problems.
Is this different from what you did?
Comment 4 Burkhard Lück 2009-09-16 08:33:54 UTC
(In reply to comment #3)
> I can't reproduce it. I created a new file, and didn't create any account
> during the new user wizard. I then clicked on new account and I was able to
> create a checking account without problems.
> Is this different from what you did?

Yes, see my comment #2.
I did not use the wizard, just start kmymoney, then Account -> New account and get an immediate crash.
Fix would be to disable this (and may be other) actions until kmymoney is configured properly in the wizard.
Comment 5 Alvaro Soliverez 2009-09-16 12:09:59 UTC
Did you create a new file or not? That detail is important, because it gives me a clue on what happened. 

The actions are disabled depending on whether they can be done or not, but this could be happening when a user is fully fresh.
Comment 6 Burkhard Lück 2009-09-16 17:57:38 UTC
(In reply to comment #5)
> Did you create a new file or not? 

".kmy"-File? No, as I wrote in my previous comments, that I did not use the wizard to setup kmymoney. 
But even without that the action "New account" was enabled.
I have to admit that this is not the normal usecase.

> That detail is important, because it gives me
> a clue on what happened. 
> 
> The actions are disabled depending on whether they can be done or not, but this
> could be happening when a user is fully fresh.

Yes, that it was a fresh user.

I have now created a ".kmy"-File and kmymoney does not crash anymore.
Comment 7 Burkhard Lück 2009-09-23 18:03:46 UTC
Now I know how to reproduce this crash at will:

1) start kmymoney without a file .kde/share/config/kmymoney2rc
2) Cancel the dialog "KMyMoney New File Setup"
3) Quit kmymoney, a kmymoney2rc with firstTimeRun=false is created -> this is the bug.
4) Start kmymoney again, now the action "New account" is enabled
5) Select this action -> kmymoney crashes immediately

Conclusion: 
Missing check, if the dialog "KMyMoney New File Setup" was cancelled.
Comment 8 Cristian Oneț 2009-09-25 22:51:08 UTC
Fixed in SVN.
It seems that the commit message didn't close the bug because I wasn't the asignee of the bug.
Comment 9 Burkhard Lück 2009-09-25 23:04:28 UTC
could you point me to the commit fixing this bug please?

Thanks!
Comment 10 KMyMoney Devel Mailing List 2009-09-25 23:12:39 UTC
SVN commit 1028093 by conet:

BUG: 207354
The crash when creating a new account was caused by the fact that a new file was created in the constructor of MyMoneyView without loading the securities and the currencies. This resulted in and incomplete initialisation of the MyMoneyFile.
The automatic new file creation was removed since for the complete initialisation the user would have to select the base currency. This means that the base currency selection dialog would have to be shown before the application window thus making it confusing.
Now the user must create the file manually by completing the new file wizzard.
Comment 11 Cristian Oneț 2009-09-25 23:14:44 UTC
(In reply to comment #9)
> could you point me to the commit fixing this bug please?
> 
> Thanks!

http://websvn.kde.org/?revision=1028093&view=revision