mmserv/tms/tmsimpl/src/tmsipcallbodyimpl.cpp
branchRCL_3
changeset 19 095bea5f582e
parent 12 2eb3b066cc7d
child 20 0ac9a5310753
--- a/mmserv/tms/tmsimpl/src/tmsipcallbodyimpl.cpp	Thu Aug 19 10:26:11 2010 +0300
+++ b/mmserv/tms/tmsimpl/src/tmsipcallbodyimpl.cpp	Tue Aug 31 15:43:02 2010 +0300
@@ -68,37 +68,38 @@
     TRACE_PRN_FN_ENT;
     iSession = new TMSCallProxy();
 
-    if (iSession)
+    TRACE_PRN_FN_ENT;
+    if (!iSession)
+        {
+        ret = TMS_RESULT_INSUFFICIENT_MEMORY;
+        }
+    RET_REASON_IF_ERR(ret);
+
+    if (iSession->Connect() != TMS_RESULT_SUCCESS)
         {
-        if (iSession->Connect() != TMS_RESULT_SUCCESS)
+        delete iSession;
+        iSession = NULL;
+        ret = TMS_RESULT_FATAL_ERROR;
+        }
+    else
+        {
+        ret = iSession->CreateCall(TMS_CALL_IP);
+        if (ret != TMS_RESULT_SUCCESS && ret != TMS_RESULT_ALREADY_EXIST)
             {
+            iSession->Close();
             delete iSession;
             iSession = NULL;
             ret = TMS_RESULT_FATAL_ERROR;
             }
-        else
-            {
-            ret = iSession->CreateCall(TMS_CALL_IP);
-            if (ret != TMS_RESULT_SUCCESS && ret != TMS_RESULT_ALREADY_EXIST)
-                {
-                iSession->Close();
-                delete iSession;
-                ret = TMS_RESULT_FATAL_ERROR;
-                }
-            }
         }
-    else
-        {
-        ret = TMS_RESULT_INSUFFICIENT_MEMORY;
-        }
+    RET_REASON_IF_ERR(ret);
     TRACE_PRN_FN_EXT;
     return ret;
     }
 
 TMSCallType TMSIPCallBodyImpl::GetCallType()
     {
-    TMSCallType ctype(TMS_CALL_IP);
-    return ctype;
+    return TMS_CALL_IP;
     }
 
 gint TMSIPCallBodyImpl::GetCallContextId(guint& ctxid)
@@ -127,7 +128,7 @@
                 ret = AddStreamToList(strm);
                 }
             //TODO:Need longer term fix to not destory everything
-            //if more the one stream is trying to be created.
+            //if more than one stream is trying to be created.
             else if (ret == TMS_RESULT_ALREADY_EXIST)
                 {
                 break;
@@ -193,9 +194,10 @@
 
     if (itStrm)
         {
+        // Remove stream object from the vector. After removing, the iterator
+        // will point to the next item (if available); so, do NOT attempt
+        // deleting itStrm here! (Will result in KERN-EXEC)
         iStreamsVector.erase(itStrm); // Remove from array
-        // Don't delete itStrm as the iterator advanced to the next
-        // item on the list
         ret = TMSStreamImpl::Delete(strm);
         }
     TRACE_PRN_FN_EXT;