Revision: 201021
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Thu, 27 May 2010 14:01:54 +0300
changeset 24 b69e63ed1902
parent 21 5e5528a288fe
child 27 d21e9641791d
Revision: 201021 Kit: 2010121
atext/server/group/extsrv.mmp
atext/server/inc/atextcommonsession.h
atext/server/inc/atextsession.h
atext/server/src/atextcommonsession.cpp
atext/server/src/atextsession.cpp
--- a/atext/server/group/extsrv.mmp	Fri May 14 16:59:23 2010 +0300
+++ b/atext/server/group/extsrv.mmp	Thu May 27 14:01:54 2010 +0300
@@ -47,7 +47,7 @@
 EPOCSTACKSIZE           0x5000 // Hack for plugins using RCmManager; remove this line when RCmManager becomes client-server
 EPOCHEAPSIZE            0x1000 0x2000000  // Use same as MCE
 
-CAPABILITY              CAP_SERVER NetworkControl CommDD
+CAPABILITY              CAP_SERVER NetworkControl CommDD PowerMgmt
 VENDORID                VID_DEFAULT
 
 SOURCEPATH              ../src
--- a/atext/server/inc/atextcommonsession.h	Fri May 14 16:59:23 2010 +0300
+++ b/atext/server/inc/atextcommonsession.h	Thu May 27 14:01:54 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -253,7 +253,7 @@
     /**
      * Session to ECOM
      */
-    REComSession iEComSession;
+    REComSession* iEComSession;
 
     /**
      * Instance of plugin
--- a/atext/server/inc/atextsession.h	Fri May 14 16:59:23 2010 +0300
+++ b/atext/server/inc/atextsession.h	Thu May 27 14:01:54 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -418,7 +418,7 @@
     /**
      * Session to ECOM
      */
-    REComSession iEComSession;
+    REComSession* iEComSession;
 
     /**
      * ECOM listener
--- a/atext/server/src/atextcommonsession.cpp	Fri May 14 16:59:23 2010 +0300
+++ b/atext/server/src/atextcommonsession.cpp	Thu May 27 14:01:54 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -11,7 +11,7 @@
 *
 * Contributors:
 *
-* Description: 
+* Description:
 *
 */
 
@@ -132,6 +132,7 @@
 CATExtCommonSession::CATExtCommonSession( CATExtSrvCommon& aServer,
                                           const TVersion& aVersion ) :
     iServer( aServer ),
+    iEComSession( NULL ),
     iVersion( aVersion )
     {
     }
@@ -158,13 +159,12 @@
         TRACE_FUNC_EXIT
         User::Leave( retTemp );
         }
-    REComSession& ecomSession = REComSession::OpenL();
-    CleanupClosePushL( ecomSession );
+    iEComSession = &REComSession::OpenL();
     RImplInfoPtrArray implementations;
     CleanupResetDestroyClosePushL( implementations );
     TUid ifUid = TUid::Uid( ATEXT_INTERFACE_COM_UID );
-    iEComSession.ListImplementationsL( ifUid,
-                                       implementations );
+    iEComSession->ListImplementationsL( ifUid,
+                                        implementations );
     if ( implementations.Count() != 1 )
         {
         TRACE_FUNC_EXIT
@@ -173,9 +173,7 @@
     TUid pluginUid = implementations[0]->ImplementationUid();
     iCommonBase = CATExtCommonBase::NewL( pluginUid, *this, connectionName );
     CleanupStack::PopAndDestroy( &implementations );
-    CleanupStack::Pop( &ecomSession );
     CleanupStack::PopAndDestroy( &connectionName );
-    iEComSession = ecomSession;
     TRACE_FUNC_EXIT
     }
 
@@ -488,7 +486,10 @@
         }
     delete iCommonBase;
     iCommonBase = NULL;
-    iEComSession.Close();
+    if ( iEComSession )
+        {
+        iEComSession->Close();
+        }
     if ( !aSyncClose )
         {
         REComSession::FinalClose();
--- a/atext/server/src/atextsession.cpp	Fri May 14 16:59:23 2010 +0300
+++ b/atext/server/src/atextsession.cpp	Thu May 27 14:01:54 2010 +0300
@@ -199,6 +199,7 @@
 //
 CATExtSession::CATExtSession( CATExtSrv& aServer, const TVersion& aVersion ) :
     iServer( aServer ),
+    iEComSession( NULL ),
     iListener( NULL ),
     iMetadata( NULL ),
     iVersion( aVersion )
@@ -217,8 +218,7 @@
         TRACE_FUNC_EXIT
         User::Leave( KErrGeneral );
         }
-    REComSession& ecomSession = REComSession::OpenL();
-    CleanupClosePushL( ecomSession );
+    iEComSession = &REComSession::OpenL();
     TPckgBuf<TUid> ifUidPckgBuf;
     TInt retTemp = ReadStructFromMessage( ifUidPckgBuf,
                                           EATExtConnectParamUid,
@@ -239,10 +239,10 @@
         User::Leave( retTemp );
         }
     // Create listener
-    CATExtListen* listener = CATExtListen::NewLC( ecomSession, this );
+    CATExtListen* listener = CATExtListen::NewLC( *iEComSession, this );
     listener->AddInterfaceUid( ifUidPckgBuf() );
     // Create metadata. Pass iListener to add the UIDs
-    CATExtMetadata* metadata = CATExtMetadata::NewLC( ecomSession,
+    CATExtMetadata* metadata = CATExtMetadata::NewLC( *iEComSession,
                                                       listener,
                                                       *this );
     metadata->CreateImplementationMetadataL( ifUidPckgBuf(), connectionName );
@@ -250,8 +250,6 @@
     CleanupStack::Pop( metadata );
     CleanupStack::Pop( listener );
     CleanupStack::PopAndDestroy( &connectionName );
-    CleanupStack::Pop( &ecomSession );
-    iEComSession = ecomSession;
     iListener = listener;
     iMetadata = metadata;
     TRACE_FUNC_EXIT
@@ -897,7 +895,10 @@
     iListener = NULL;
     delete iMetadata;
     iMetadata = NULL;
-    iEComSession.Close();
+    if ( iEComSession )
+        {
+        iEComSession->Close();
+        }
     if ( !aSyncClose )
         {
         REComSession::FinalClose();