Bug 199580 - Crash when disconnecting from WLM
Summary: Crash when disconnecting from WLM
Status: RESOLVED FIXED
Alias: None
Product: kopete
Classification: Unmaintained
Component: WLM Plugin (show other bugs)
Version: unspecified
Platform: Gentoo Packages Linux
: NOR crash
Target Milestone: ---
Assignee: Kopete Developers
URL:
Keywords:
: 220509 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-07-09 18:20 UTC by Lamarque V. Souza
Modified: 2009-12-29 17:15 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Makes race condition unlikely to happen (2.33 KB, patch)
2009-07-09 18:21 UTC, Lamarque V. Souza
Details
Backtrace of the crash (8.05 KB, text/plain)
2009-07-09 18:23 UTC, Lamarque V. Souza
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lamarque V. Souza 2009-07-09 18:20:22 UTC
Version:            (using KDE 4.2.4)
Compiler:          gcc version 4.3.2 Gentoo 4.3.2-r3 p1.6, pie-10.1.5
OS:                Linux
Installed from:    Gentoo Packages

Sometimes Kopete crashes when disconnecting from WLM server. I think I have found the cause, which seems a race condition in WlmServer::WlmDisconnect:

1    if (mainConnection)
2    {
3        disconnecting = true;
4        QListIterator<WlmSocket *> i(cb.socketList);
5        while (i.hasNext())
6        {
7            a = i.next();
8            QObject::disconnect (a, 0, 0, 0);
9            cb.socketList.removeAll (a);
10        }
11        cb.socketList.clear ();

12        if (mainConnection->connectionState () !=
13            MSN::NotificationServerConnection::NS_DISCONNECTED)
14        {
15            delete mainConnection;
16            mainConnection = NULL;
17        }
18    }

If WlmServer::WlmDisconnect is called twice in a really short time frame between the if in line 1 and the delete in line 15 some time will passed and the second run of WlmServer::WlmDisconnect will enter the if and delete mainConnection object for a second time, which will cause Kopete to crash.
Comment 1 Lamarque V. Souza 2009-07-09 18:21:58 UTC
Created attachment 35199 [details]
Makes race condition unlikely to happen
Comment 2 Lamarque V. Souza 2009-07-09 18:23:56 UTC
Created attachment 35200 [details]
Backtrace of the crash
Comment 3 Roman Jarosz 2009-12-29 16:12:28 UTC
SVN commit 1067407 by rjarosz:

Use deleteLater instead of delete for WlmServer because Connection::disconnect may access it after delete was called.
Don't leak NotificationServerConnection if user typed bad password (and porbably on other errors too).
Use standard bad password disconnection.

BUG: 199580


 M  +5 -7      wlmaccount.cpp  
 M  +3 -7      wlmserver.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1067407
Comment 4 Roman Jarosz 2009-12-29 17:15:41 UTC
*** Bug 220509 has been marked as a duplicate of this bug. ***