diff -r 73ea206103e6 -r 43365a9b78a3 userlibandfileserver/fileserver/sfile/sf_ext.cpp --- a/userlibandfileserver/fileserver/sfile/sf_ext.cpp Wed Jun 23 19:44:53 2010 +0300 +++ b/userlibandfileserver/fileserver/sfile/sf_ext.cpp Tue Jul 06 15:50:07 2010 +0300 @@ -52,7 +52,7 @@ */ CProxyDrive::~CProxyDrive() { - + delete iBody; } @@ -175,6 +175,32 @@ } +TInt CProxyDrive::SetAndOpenLibrary(RLibrary aLibrary) + { + TInt r = KErrNone; + if (iBody) + { + iBody->iLibrary = aLibrary; + r = iBody->iLibrary.Duplicate(RThread(), EOwnerProcess); + } + return r; + } + +/** +Gets a copy of the Proxy Drive library (previously opened by OpenLibrary()) prior to deleting the proxy drive itself. +After deleting the proxy drive, RLibrary::Close() should be called on the returned RLibrary object. +*/ +RLibrary CProxyDrive::GetLibrary() + { + RLibrary lib; + if (iBody) + { + lib = iBody->iLibrary; + iBody->iLibrary.SetHandle(NULL); + } + return lib; + } + /** Constructor. */ @@ -189,8 +215,12 @@ EXPORT_C CLocDrvMountCB::~CLocDrvMountCB() { __PRINT1(_L("CLocDrvMountCB::~CLocDrvMountCB() 0x%x"),this); - if(iProxyDrive && !LocalDrives::IsProxyDrive(Drive().DriveNumber()) && LocalDrives::IsValidDriveMapping(Drive().DriveNumber())) - delete(iProxyDrive); + if(iProxyDrive && !LocalDrives::IsProxyDrive(Drive().DriveNumber())) + { + RLibrary lib = iProxyDrive->GetLibrary(); + delete iProxyDrive; + lib.Close(); + } } @@ -282,7 +312,6 @@ { __ASSERT_ALWAYS(iProxyDrive!=NULL,Fault(ELocDrvDismountedLocalDrive)); iProxyDrive->Dismounted(); - iProxyDrive->SetMount(NULL); }