connectivitymodules/SeCon/services/pcd/src/sconvideoparser.cpp
changeset 20 e1de7d03f843
parent 19 2691f6aa1921
child 26 fdc38da86094
--- a/connectivitymodules/SeCon/services/pcd/src/sconvideoparser.cpp	Fri Mar 19 09:27:26 2010 +0200
+++ b/connectivitymodules/SeCon/services/pcd/src/sconvideoparser.cpp	Fri Apr 16 14:53:26 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-2009 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"
@@ -57,13 +57,6 @@
         iVideoUtil->Close();
         }
     delete iVideoUtil;
-    
-    if ( iWindow )
-        {
-        iWindow->Close();
-        }
-    delete iWindow;
-    iRootWindow.Close();
     delete iScreen;
     iWsSession.Close();
     
@@ -97,16 +90,26 @@
     User::LeaveIfError( iWsSession.Connect() );
     
     iScreen = new(ELeave) CWsScreenDevice( iWsSession );
-    User::LeaveIfError( iScreen->Construct() );
+    iScreen->Construct();
+    
+    RWindowGroup wg( iWsSession );
+    User::LeaveIfError( wg.Construct(reinterpret_cast<TUint32>(&wg), EFalse) );
+    CleanupClosePushL( wg );
     
-    iRootWindow = RWindowGroup(iWsSession);
-    User::LeaveIfError( iRootWindow.Construct(reinterpret_cast<TUint32>(&iWsSession), EFalse) );
+    CWindowGc* gc;
+    User::LeaveIfError( iScreen->CreateContext(gc) );
+    CleanupStack::PushL(gc);
     
-    iWindow = new(ELeave) RWindow( iWsSession );
-    User::LeaveIfError( iWindow->Construct(iRootWindow, reinterpret_cast<TUint32>(&iRootWindow) + 1) );
+    RWindow window( iWsSession );
+    User::LeaveIfError( window.Construct(wg, reinterpret_cast<TUint32>(&wg) + 1) );
+    CleanupClosePushL( window );
     
     TRect temp(0,0,320,240); // dummy parameter
-    iVideoUtil = CVideoPlayerUtility::NewL(*this, EMdaPriorityNormal, EMdaPriorityPreferenceNone, iWsSession, *iScreen, *iWindow, temp, temp);
+    iVideoUtil = CVideoPlayerUtility::NewL(*this, EMdaPriorityNormal, EMdaPriorityPreferenceNone, iWsSession, *(iScreen), window, temp, temp);
+    
+    CleanupStack::PopAndDestroy( &window );
+    CleanupStack::PopAndDestroy( gc );
+    CleanupStack::PopAndDestroy( &wg );
     
     iTimeOut = CSconTimeOut::NewL( *this );