diff -r 345b1ca54e88 -r 039a3e647356 userlibandfileserver/fileserver/sfsrv/cl_fman.cpp --- a/userlibandfileserver/fileserver/sfsrv/cl_fman.cpp Wed Sep 15 13:42:27 2010 +0300 +++ b/userlibandfileserver/fileserver/sfsrv/cl_fman.cpp Wed Oct 13 16:04:24 2010 +0300 @@ -265,24 +265,21 @@ // Initialise New thread // { - TInt r = KErrNoMemory; // return value if a trap harness cannot be created + CTrapCleanup* cleanup=CTrapCleanup::New(); + if (cleanup==NULL) + return(KErrNoMemory); CFileBase& fMan=*(CFileBase*)aPtr; - - if (cleanup != NULL) - { - fMan.iSynchronizer.Wait(); - TRAP(r,DoFManBaseOperationL(aPtr)); - if (r == KErrNone) - r = fMan.iLastError; - delete cleanup; - } - + fMan.iSynchronizer.Wait(); + TRAPD(ret,DoFManBaseOperationL(aPtr)); + if (ret==KErrNone) + ret=fMan.iLastError; + delete cleanup; fMan.iSwitches=0; fMan.iFs=fMan.iFsOld; fMan.iStatus=NULL; fMan.iFManThread.Close(); - return (r); + return(ret); } @@ -295,6 +292,9 @@ @param aThreadFunction The thread function. */ { + iSwitches|=KFManBusyFlag; + User::LeaveIfError(iFManThread.Create(KNullDesC,aThreadFunction,KDefaultStackSize,NULL,this)); + iFManThread.SetPriority(EPriorityMuchLess); TFileName sessionPath; User::LeaveIfError(iFs.SessionPath(sessionPath)); if (iSessionPath==NULL) @@ -302,14 +302,6 @@ else if (iSessionPath->Des().MaxLength()ReAllocL(IncPathLength(sessionPath.Length())); iSessionPath->Des()=sessionPath; - - User::LeaveIfError(iFManThread.Create(KNullDesC,aThreadFunction,KDefaultStackSize,NULL,this)); - - // The code won't leave anymore after this. - // The effect of any further state changes to this instance - // should be undone / completed by the thread function. - iFManThread.SetPriority(EPriorityMuchLess); - iSwitches|=KFManBusyFlag; iFsOld=iFs; iLastError=KErrNone; iFManThread.Logon(*iStatus);