memspy/Engine/Source/ThreadAndProcess/MemSpyEngineObjectThreadInfoObjects.cpp
branchRCL_3
changeset 49 7fdc9a71d314
parent 44 52e343bb8f80
child 59 8ad140f3dd41
--- a/memspy/Engine/Source/ThreadAndProcess/MemSpyEngineObjectThreadInfoObjects.cpp	Wed Sep 15 00:19:18 2010 +0300
+++ b/memspy/Engine/Source/ThreadAndProcess/MemSpyEngineObjectThreadInfoObjects.cpp	Wed Sep 15 13:53:27 2010 +0300
@@ -123,6 +123,17 @@
     return TPtrC( item->Combined() );
     }
 
+EXPORT_C TPtrC CMemSpyThreadInfoItemBase::Caption(TInt aIndex ) const
+	{
+	CItem* item = iItems[ aIndex ];
+	return TPtrC( item->Caption() );
+	}
+
+EXPORT_C TPtrC CMemSpyThreadInfoItemBase::Value(TInt aIndex ) const
+	{
+	CItem* item = iItems[ aIndex ];
+	return TPtrC( item->Value() );
+	}
 
 EXPORT_C CMemSpyEngine& CMemSpyThreadInfoItemBase::Engine() const
     {
@@ -1691,20 +1702,18 @@
 #endif
 
     // See if we have an entry with that name...
-    TIdentityRelation<CSessionInfoEntry> comparer( CompareEntries );
-    HBufC* name = aName.AllocLC();
-    CSessionInfoEntry* entry = new(ELeave) CSessionInfoEntry( name );
-    CleanupStack::Pop( name );
-    CleanupStack::PushL( entry );
-    const TInt foundIndex = iServerNames.Find( entry, comparer );
-    CleanupStack::PopAndDestroy( entry );
+    TInt foundIndex = 0;
+    TRAP(ret, foundIndex = FindServerL(aName));
     
-    // If we did, get the count
-    if  ( foundIndex >=0 && foundIndex < iServerNames.Count() )
+    if (ret == KErrNone)
         {
-        ret = iServerNames[ foundIndex ]->iCount;
+        // If we did, get the count
+        if  ( foundIndex >=0 && foundIndex < iServerNames.Count() )
+            {
+            ret = iServerNames[ foundIndex ]->iCount;
+            }
         }
-    //
+
 #ifdef _DEBUG
     RDebug::Printf( "CMemSpyThreadInfoSession::ConnectionCount() - END - ret: %d", ret );
 #endif
@@ -1712,10 +1721,22 @@
     return ret;
     }
 
+TInt CMemSpyThreadInfoSession::FindServerL( const TDesC& aName ) const
+    {
+    TIdentityRelation<CSessionInfoEntry> comparer( CompareEntries );
+    HBufC* name = aName.AllocLC();
+    CSessionInfoEntry* entry = new(ELeave) CSessionInfoEntry( name );
+    CleanupStack::Pop( name ); // don't destroy it as name is now owned by entry 
+    CleanupStack::PushL( entry );
+    const TInt foundIndex = iServerNames.Find( entry, comparer );
+    User::LeaveIfError(foundIndex); // so we only return a real index
+    CleanupStack::PopAndDestroy( entry );
+    return foundIndex;
+    }
 
 void CMemSpyThreadInfoSession::HandleContainerItemL( TMemSpyDriverHandleInfoGeneric& aItem, TInt /*aRefCount*/, TDes& aFullName )
     {
-    // Check whether we have the item already?
+    // Check whether we have the item already
     TIdentityRelation<CSessionInfoEntry> comparer( CompareEntries );
 
     // Prepare object, just in case we don't find it...