graphicscomposition/openwfsupport/src/streammap.cpp
changeset 98 bf7481649c98
parent 0 5d03bc08d59c
child 121 d72fc2aace31
--- a/graphicscomposition/openwfsupport/src/streammap.cpp	Thu May 27 14:13:51 2010 +0300
+++ b/graphicscomposition/openwfsupport/src/streammap.cpp	Fri Jun 11 14:58:47 2010 +0300
@@ -17,6 +17,7 @@
 
 #include "streammap.h"
 #include <graphics/updateserverprovider.h>
+#include <graphics/surfacemanager.h>
 #include <e32property.h>
 #include <e32std.h>
 #include <e32cmn.h>
@@ -119,7 +120,8 @@
 
 RSurfaceManager& COpenWfcStreamMap::SurfaceManager()
 	{
-	return iSurfaceManager;
+    WFCI_ASSERT_DEBUG(iSurfaceManager, EOwfPanicInvalidHasMap);
+	return *iSurfaceManager;
 	}
 
 TInt COpenWfcStreamMap::LockDestroy(CSurfaceStream* aStream)
@@ -157,6 +159,7 @@
 
 COpenWfcStreamMap::COpenWfcStreamMap():
 iMap(THashFunction32<TSurfaceId>(COpenWfcStreamMap::HashFunction), TIdentityRelation<TSurfaceId>()),
+iSurfaceManager(NULL),
 iRegisteredUpdaters()
 	{
 	}
@@ -202,7 +205,12 @@
             }
         }
 	iMap.Close();
-	iSurfaceManager.Close();
+    if (iSurfaceManager)
+        {
+        iSurfaceManager->Close();
+        delete iSurfaceManager;
+        iSurfaceManager = NULL;
+        }
 	iMutex.Signal();
 	iMutex.Close();
 	
@@ -241,7 +249,8 @@
 	TSurfaceId surface = TSurfaceId::CreateNullId();
 	User::LeaveIfError(iMap.Insert(surface, NULL));
 
-	User::LeaveIfError(iSurfaceManager.Open());
+	iSurfaceManager = new(ELeave) RSurfaceManager();
+	User::LeaveIfError(iSurfaceManager->Open());
 	RProcess process;
 	TUidType uidType = process.Type();
 	const TInt32 KWservUid = 268450592;