File bluedevil-obexsession-iterators.diff of Package bluedevil
diff --git a/src/daemon/obexftpkded/ObexFtpDaemon.cpp b/src/daemon/obexftpkded/ObexFtpDaemon.cpp
index ce7e675..f4d70ad 100644
--- a/src/daemon/obexftpkded/ObexFtpDaemon.cpp
+++ b/src/daemon/obexftpkded/ObexFtpDaemon.cpp
@@ -337,17 +337,18 @@ void ObexFtpDaemon::SessionConnected(QDBusObjectPath path)
void ObexFtpDaemon::SessionClosed(QDBusObjectPath path)
{
kDebug();
- QHash<QString, ObexSession*>::const_iterator i = d->m_sessionMap.constBegin();
- while (i != d->m_sessionMap.constEnd()) {
+ QHash<QString, ObexSession*>::iterator i = d->m_sessionMap.begin();
+ while (i != d->m_sessionMap.end()) {
//If the session is connected, so not 0
if (i.value()->path() == path.path()) {
kDebug() << "Removing : " << i.key();
emit sessionClosed(i.key());
- d->m_sessionMap.remove(i.key());
delete i.value();
+ i = d->m_sessionMap.erase(i);
return;
+ } else {
+ ++i;
}
- ++i;
}
kDebug() << "Attempt to remove a nto existing session";