Bug 165079 - Kopete crashes when closing wallet
Summary: Kopete crashes when closing wallet
Alias: None
Product: kopete
Classification: Applications
Component: general (show other bugs)
Version: SVN
Platform: Compiled Sources Linux
: NOR crash
Target Milestone: ---
Assignee: Kopete Developers
: 165562 (view as bug list)
Depends on:
Reported: 2008-06-27 06:17 UTC by Raphael Kubo da Costa
Modified: 2008-11-11 11:09 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:

patch to fix this bug in kopete (1.08 KB, patch)
2008-06-28 01:14 UTC, Michael Leupold

Note You need to log in before you can comment on or make changes to this bug.
Description Raphael Kubo da Costa 2008-06-27 06:17:44 UTC
Version:           svn r824991 (using Devel)
Installed from:    Compiled sources
OS:                Linux

I'm not sure if this is a Kopete or KWallet bug. Some days ago, Kopete started crashing when I close it. Here is the backtrace:

Application: Kopete (kopete), signal SIGABRT
[Thread debugging using libthread_db enabled]
[New Thread 0xb54f36d0 (LWP 609)]
[KCrash handler]
#6  0xb7f75424 in __kernel_vsyscall ()
#7  0xb5a6f740 in raise () from /lib/libc.so.6
#8  0xb5a71078 in abort () from /lib/libc.so.6
#9  0xb7d4a6bc in qt_message_output (msgType=QtFatalMsg, 
    buf=0xbfa8ed60 "Fatal Error: Accessed global static 'KWalletDLauncher *walletLauncher()' after destruction. Defined at /home/kubo/kde4/src/KDE/kdelibs/kdeui/util/kwallet.cpp:128") at global/qglobal.cpp:2058
#10 0xb7d4a720 in qFatal (
    msg=0xb79bc89c "Fatal Error: Accessed global static '%s *%s()' after destruction. Defined at %s:%d") at global/qglobal.cpp:2260
#11 0xb78defe3 in operator-> (this=0xb79e84f0)
    at /home/kubo/kde4/src/KDE/kdelibs/kdeui/util/kwallet.cpp:128
#12 0xb78e1d9a in ~Wallet (this=0x8be3d20)
    at /home/kubo/kde4/src/KDE/kdelibs/kdeui/util/kwallet.cpp:156
#13 0xb691c30e in Kopete::WalletManager::closeWallet (this=0xb694ff28)
    at /home/kubo/kde4/src/KDE/kdenetwork/kopete/libkopete/kopetewalletmanager.cpp:167
#14 0xb691c3cd in ~WalletManager (this=0xb694ff28)
    at /home/kubo/kde4/src/KDE/kdenetwork/kopete/libkopete/kopetewalletmanager.cpp:60
#15 0xb5a726c9 in exit () from /lib/libc.so.6
#16 0xb5a5b5cd in __libc_start_main () from /lib/libc.so.6
#17 0x08064681 in _start ()
#0  0xb7f75424 in __kernel_vsyscall ()
Comment 1 Michael Leupold 2008-06-27 22:58:44 UTC
I can confirm this bug. It stems from the recent changes in kwalletd. I'll look into it.
Comment 2 Michael Leupold 2008-06-28 01:14:58 UTC
Created attachment 25660 [details]
patch to fix this bug in kopete

This bug stems from a problem with the destruction of static objects.
KWallet::Wallet uses a static which gets destructed before the function-static
Kopete::WalletManager gets destructed. I also have a fix for kwallet to not
crash but basically kopete needs a fix as well because:
- without it the wallet will not be closed
- I think closing a wallet in that state is no longer possible as the main
event-loop is already gone.
Comment 3 Raphael Kubo da Costa 2008-06-29 06:11:43 UTC
The bug seems to have been fixed as of rev825570.
Comment 4 Michael Leupold 2008-06-29 10:20:04 UTC
No, it's not yet fixed. I just implemented a work-around in kwalletd so it doesn't crash. The problem is still visible though in that "kopete" doesn't close the wallet it opened - you can even see it's still in the list of programs using it after kopete already exited. :)
Thus I'll reduce severity to normal and reopen.
Comment 5 Christophe Marin 2008-07-02 11:35:29 UTC
*** Bug 165562 has been marked as a duplicate of this bug. ***
Comment 6 Christophe Marin 2008-07-03 10:52:31 UTC
*** Bug 165608 has been marked as a duplicate of this bug. ***
Comment 7 Michael Leupold 2008-11-11 11:09:38 UTC
SVN commit 882694 by mleupold:

1. Implement session handling for applications using the KWallet API. If an application with an open wallet exits or even crashes, kwalletd will know and close the wallet (if 
autoclose if last client exits is set). For this to work I added the handleSession parameter to the openAsync call. Clients not using the API can continue to use the old DBus 
open call (no changes needed). Drawback: If an application exits/crashes while the password entry dialog is shown, the wallet will still be opened (albeit autoclosed afterwards). 
I don't intend to change this as it would be too messy and this cornercase is just not important enough.

2. Implement asynchroneous handling of openPath calls. openPath now uses transactions as well (almost identical to openAsync).

3. Create tests for the new changes and one for tracking concurrency problems (kwalletmany).

BUG: 165079

 M  +8 -0      kdebase/runtime/kwalletd/backend/kwalletbackend.cc  
 M  +1 -1      kdebase/runtime/kwalletd/backend/kwalletbackend.h  
 M  +317 -95   kdebase/runtime/kwalletd/kwalletd.cpp  
 M  +42 -11    kdebase/runtime/kwalletd/kwalletd.h  
 M  +8 -4      kdebase/runtime/kwalletd/kwalletdadaptor.h  
 M  +30 -0     kdebase/runtime/kwalletd/tests/CMakeLists.txt  
 A             kdebase/runtime/kwalletd/tests/kwalletautoclose.cpp   [License: LGPL (v2+)]
 A             kdebase/runtime/kwalletd/tests/kwalletautoclose.h   [License: LGPL (v2+)]
 A             kdebase/runtime/kwalletd/tests/kwalletnoautoclose.cpp   [License: LGPL (v2+)]
 A             kdebase/runtime/kwalletd/tests/kwalletpath.cpp   [License: UNKNOWN]
 M  +6 -22     kdelibs/kdeui/util/kwallet.cpp  
 M  +8 -0      kdelibs/kdeui/util/org.kde.KWallet.xml  

WebSVN link: http://websvn.kde.org/?view=rev&revision=882694