userlibandfileserver/fileserver/sfile/sf_thread.cpp
changeset 149 d9f1e5bfe28c
parent 31 56f325a607ea
child 176 af6ec97d9189
equal deleted inserted replaced
135:5e441a173c63 149:d9f1e5bfe28c
   924 	TUint id=t.Id();
   924 	TUint id=t.Id();
   925 	return(id);
   925 	return(id);
   926 	}
   926 	}
   927 
   927 
   928 
   928 
   929 CPluginThread::CPluginThread(CFsPlugin& aPlugin)
   929 CPluginThread::CPluginThread(CFsPlugin& aPlugin, RLibrary aLibrary)
   930   : iPlugin(aPlugin)
   930   : iPlugin(aPlugin), iLib(aLibrary)
   931 	{
   931 	{
   932 	/** @prototype */
   932 	/** @prototype */
   933 	iOperationLock.Close();
   933 	iOperationLock.Close();
   934 	iPlugin.Open();
   934 	iPlugin.Open();
       
   935 	
       
   936     /* 
       
   937     Duplicate the handle to the DLL which created the plugin to prevent 
       
   938     TFsRemovePlugin::DoRequestL() from unmapping the DLL's code segment before
       
   939     this thread's destructor has been called as the destructor closes the plugin 
       
   940     which results in a call to the plugin's derived destructor contained in the DLL (!)
       
   941     */ 
       
   942     TInt r = iLib.Duplicate(iThread, EOwnerProcess);
       
   943     __ASSERT_ALWAYS(r==KErrNone, Fault(EFsThreadConstructor));
   935 	}
   944 	}
   936 
   945 
   937 CPluginThread::~CPluginThread()
   946 CPluginThread::~CPluginThread()
   938     {
   947     {
   939     iPlugin.Close();
   948     iPlugin.Close();
       
   949 	iLib.Close();
   940     }
   950     }
   941 
   951 
   942 
   952 
   943 CPluginThread* CPluginThread::NewL(CFsPlugin& aPlugin)
   953 CPluginThread* CPluginThread::NewL(CFsPlugin& aPlugin, RLibrary aLibrary)
   944 	{
   954 	{
   945 	__PRINT(_L("CPluginThread::NewL()"));
   955 	__PRINT(_L("CPluginThread::NewL()"));
   946 	CPluginThread* pT=new(ELeave) CPluginThread(aPlugin);
   956 	CPluginThread* pT=new(ELeave) CPluginThread(aPlugin, aLibrary);
   947 	TInt r=pT->Initialise();
   957 	TInt r=pT->Initialise();
   948 
   958 
   949 	/** @prototype */
   959 	/** @prototype */
   950 	if(r == KErrNone)
   960 	if(r == KErrNone)
   951 		r=pT->iOperationLock.CreateLocal(0);
   961 		r=pT->iOperationLock.CreateLocal(0);