# HG changeset patch # User William Roberts # Date 1275052862 -3600 # Node ID d2197ff6de2bbf6a7bb05b7542b1bfb68a08fe7e # Parent bfa24657ff9fdc1e135dd4bde1938f27008188ab# Parent db335d34648757bc617533a63c627f8045a4ed73 Re-merge fix for bug 2485 diff -r db335d346487 -r d2197ff6de2b usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/eventhandler.cpp --- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/eventhandler.cpp Tue May 18 17:01:48 2010 +0100 +++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/eventhandler.cpp Fri May 28 14:21:02 2010 +0100 @@ -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; }