userlibandfileserver/fileserver/shostmassstorage/server/src/cusbhostmssession.cpp
--- a/userlibandfileserver/fileserver/shostmassstorage/server/src/cusbhostmssession.cpp Mon Sep 13 15:16:07 2010 +0100
+++ b/userlibandfileserver/fileserver/shostmassstorage/server/src/cusbhostmssession.cpp Wed Sep 22 10:53:45 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
// All rights reserved.
// This component and the accompanying materials are made available
// under the terms of the License "Eclipse Public License v1.0"
@@ -114,8 +114,16 @@
return;
}
break;
- case EUsbHostMsUnRegisterInterface:
- iCleanupInProgress = ETrue;
+ case EUsbHostMsUnRegisterInterface:
+ if(iCleanupInProgress)
+ {
+ aMessage.Complete(KErrInUse);
+ return;
+ }
+ else
+ {
+ iCleanupInProgress = ETrue;
+ }
break;
/* If it is a cleanup then we need to delete the iDeviceThread */
case EUsbHostMsFinalCleanup:
@@ -128,12 +136,17 @@
break;
}
- if (iDeviceThread == NULL || iCleanupInProgress )
+ if (iDeviceThread == NULL)
{
aMessage.Complete(KErrBadHandle);
return;
}
+ if (iCleanupInProgress && aMessage.Function() != EUsbHostMsUnRegisterInterface)
+ {
+ aMessage.Complete(KErrBadHandle);
+ return;
+ }
r = iDeviceThread->QueueMsg(aMessage);
if (r != KErrNone)
@@ -174,7 +187,7 @@
iDeviceThread = NULL;
User::Leave(r);
}
- iThread.SetPriority(EPriorityAbsoluteBackgroundNormal);
+ iThread.SetPriority(EPriorityAbsoluteForeground);
TRequestStatus status;
iThread.Rendezvous(status);
iThread.Resume();