diff -r 5af6c74cd793 -r af6ec97d9189 userlibandfileserver/fileserver/sfile/sf_ext.cpp --- a/userlibandfileserver/fileserver/sfile/sf_ext.cpp Wed Jun 23 11:59:44 2010 +0100 +++ b/userlibandfileserver/fileserver/sfile/sf_ext.cpp Wed Jun 23 12:52:28 2010 +0100 @@ -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); }