javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtinput.cpp
branchRCL_3
changeset 60 6c158198356e
parent 19 04becd199f91
--- a/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtinput.cpp	Thu Jul 15 18:31:06 2010 +0300
+++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/swtinput.cpp	Thu Aug 19 09:48:13 2010 +0300
@@ -24,7 +24,10 @@
 //
 CSwtInput* CSwtInput::NewL(TSwtPeer aPeer, TInt aId)
 {
-    CSwtInput* self = new(ELeave) CSwtInput(aPeer, aId);
+    CSwtInput* self = new(ELeave) CSwtInput(aPeer);
+    CleanupStack::PushL(self);
+    self->ConstructL(aId);
+    CleanupStack::Pop(self);
     return self;
 }
 
@@ -32,21 +35,27 @@
 // CSwtInput::CSwtInput
 // ---------------------------------------------------------------------------
 //
-CSwtInput::CSwtInput(TSwtPeer aPeer, TInt aId)
+CSwtInput::CSwtInput(TSwtPeer aPeer)
         : iPeer(aPeer)
+        , iType(KErrNotFound)
+        , iLocation(KErrNotFound)
 {
-    iType = KErrNotFound;
-    iLocation = KErrNotFound;
+}
+
+void CSwtInput::ConstructL(TInt aId)
+{
     RArray<CSwtMobileDevice::TSwtHwInput> inputs;
-    CSwtMobileDevice::GetHwInputs(inputs);
+    CleanupClosePushL(inputs);
+    CSwtMobileDevice::GetHwInputsL(inputs);
     if (aId < inputs.Count())
     {
         iType = inputs[aId].iType;
         iLocation = inputs[aId].iLocation;
     }
-    inputs.Close();
+    CleanupStack::PopAndDestroy(&inputs);
 }
 
+
 // ---------------------------------------------------------------------------
 // CSwtInput::~CSwtInput
 // ---------------------------------------------------------------------------