# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1274787585 -10800 # Node ID bfa24657ff9fdc1e135dd4bde1938f27008188ab # Parent 6ba7b7d87ab3c8eefb20c2ba2f5ddf4abc568460 Revision: 201018 Kit: 2010121 diff -r 6ba7b7d87ab3 -r bfa24657ff9f usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/eventhandler.cpp --- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/eventhandler.cpp Tue May 11 17:53:46 2010 +0300 +++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/eventhandler.cpp Tue May 25 14:39:45 2010 +0300 @@ -212,9 +212,12 @@ LOG_FUNC // Complete client with KErrCancel CompleteClient(KErrCancel); - + // Cancel current pending command - iSubCommandQueue.Head().CancelAsyncCmd(); + if (iSubCommandQueue.Count()) + { + iSubCommandQueue.Head().CancelAsyncCmd(); + } } void CDeviceEventHandler::RunL( ) @@ -251,30 +254,33 @@ TInt CDeviceEventHandler::RunError(TInt aError) { LOG_FUNC - // Retrieve sub-command related error notification data - iSubCommandQueue.Head().HandleError(*iErrNotiData, aError); - - // If current sub-command isn't a key one, the handler will continue to - // execute rest sub-command in the queue. But, if current sub-command - // is the last one in the queue, handler shall complete the client also. - if (iSubCommandQueue.Head().IsKeyCommand() || - (iSubCommandQueue.Count() == 1)) + + if (iSubCommandQueue.Count()) { - CompleteClient(aError); + // Retrieve sub-command related error notification data + iSubCommandQueue.Head().HandleError(*iErrNotiData, aError); + + // If current sub-command isn't a key one, the handler will continue to + // execute rest sub-command in the queue. But, if current sub-command + // is the last one in the queue, handler shall complete the client also. + if (iSubCommandQueue.Head().IsKeyCommand() || + (iSubCommandQueue.Count() == 1)) + { + CompleteClient(aError); + } + iSubCommandQueue.Pop(); } - //Restart the handler after error handling; - if (!IsActive()) + if( IsActive() ) + { + Complete(aError); + } + else if (iSubCommandQueue.Count()) { Start(); + Complete(); } - Complete(aError); - - if (iSubCommandQueue.Count()) - { - iSubCommandQueue.Pop(); - } - + return KErrNone; }