userlibandfileserver/fileserver/sfile/sf_ext.cpp
branchRCL_3
changeset 41 0ffb4e86fcc9
parent 36 bbf8bed59bcb
child 43 c1f20ce4abcf
--- a/userlibandfileserver/fileserver/sfile/sf_ext.cpp	Mon Jun 21 17:12:14 2010 +0300
+++ b/userlibandfileserver/fileserver/sfile/sf_ext.cpp	Thu Jul 15 20:11:42 2010 +0300
@@ -51,7 +51,7 @@
 */
 CProxyDrive::~CProxyDrive()
 	{
-	
+	delete iBody;
 	}
 
 
@@ -174,6 +174,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,7 +215,11 @@
 	{
 	__PRINT1(_L("CLocDrvMountCB::~CLocDrvMountCB() 0x%x"),this);
 	if(iProxyDrive && !LocalDrives::IsProxyDrive(Drive().DriveNumber()))
-		delete(iProxyDrive);
+		{
+		RLibrary lib = iProxyDrive->GetLibrary();
+		delete iProxyDrive;
+		lib.Close();
+		}
 	}