diff -r 0aa8cc770c8a -r 4a793f564d72 mtpfws/mtpfw/src/cmtpconnection.cpp --- a/mtpfws/mtpfw/src/cmtpconnection.cpp Tue Aug 31 16:03:15 2010 +0300 +++ b/mtpfws/mtpfw/src/cmtpconnection.cpp Wed Sep 01 12:20:56 2010 +0100 @@ -82,9 +82,17 @@ __FLOG(_L8("~CMTPConnection - Entry")); CloseAllSessions(); - //remove all events - DequeueAllEvents(); - + // Remove any events not associated + // with a session + TSglQueIter iter(iEventQ); + iter.SetToFirst(); + CMTPEventLink* link = NULL; + + while ((link = iter++) != NULL) + { + delete link; + } + iSessions.ResetAndDestroy(); if (iTransportConnection != NULL) @@ -659,16 +667,9 @@ DequeueEvent(iEventQ.First()); if (iPendingEventCount > 0) { - if (NULL != iTransportConnection) - { - // Forward the event to the transport connection layer. - __FLOG(_L8("Sending queued event")); - iTransportConnection->SendEventL(iEventQ.First()->iEvent); - } - else - { - DequeueAllEvents(); - } + // Forward the event to the transport connection layer. + __FLOG(_L8("Sending queued event")); + iTransportConnection->SendEventL(iEventQ.First()->iEvent); } __FLOG(_L8("SendEventCompleteL - Exit")); @@ -1045,19 +1046,6 @@ __FLOG(_L8("RemoveEventsForSession - Exit")); } -void CMTPConnection::DequeueAllEvents() - { - TSglQueIter iter(iEventQ); - iter.SetToFirst(); - CMTPEventLink* link = NULL; - - while ((link = iter++) != NULL) - { - delete link; - } - iPendingEventCount = 0; - } - void CMTPConnection::DequeueEvent(CMTPEventLink* aLink) { iEventQ.Remove(*aLink);