telephonyserverplugins/common_tsy/commontsy/src/mmsms/cmmsmstsy.cpp
changeset 20 244d7c5f118e
parent 19 1f776524b15c
child 23 6b1d113cdff3
--- a/telephonyserverplugins/common_tsy/commontsy/src/mmsms/cmmsmstsy.cpp	Fri Mar 19 09:55:57 2010 +0200
+++ b/telephonyserverplugins/common_tsy/commontsy/src/mmsms/cmmsmstsy.cpp	Fri Apr 16 16:12:37 2010 +0300
@@ -34,7 +34,8 @@
 
 // ======== MEMBER FUNCTIONS ========
 
-CMmSmsTsy::CMmSmsTsy()
+CMmSmsTsy::CMmSmsTsy():
+    iReqHandleType(EMultimodeSmsReqHandleUnknown)
     {
 TFLOGSTRING("TSY: CMmSmsTsy::CMmSmsTsy: constructor");
     }
@@ -285,8 +286,13 @@
                 break;
             // SMS messaging requests that need trapping
             default:
-                // reset last tsy request type
-                iReqHandleType = EMultimodeSmsReqHandleUnknown; 
+                // Ensure the ReqHandleType is unset.
+                // This will detect cases where this method indirectly calls itself
+                // (e.g. servicing a client call that causes a self-reposting notification to complete and thus repost).
+                // Such cases are not supported because iReqHandleType is in the context of this class instance,
+                // not this request, and we don't want the values set by the inner request and the outer request
+                // interfering with each other.
+                __ASSERT_DEBUG(iReqHandleType==EMultimodeSmsReqHandleUnknown, User::Invariant());
 
                 TInt leaveCode( KErrNone );
                 TRAP( leaveCode, ret = DoExtFuncL( aTsyReqHandle, aIpc, 
@@ -308,6 +314,9 @@
                     iTsyReqHandleStore->SetTsyReqHandle( iReqHandleType, 
                         aTsyReqHandle );
 #endif // REQHANDLE_TIMER
+                    // We've finished with this value now. Clear it so it doesn't leak
+                    //  up to any other instances of this method down the call stack
+                    iReqHandleType = EMultimodeSmsReqHandleUnknown;
                     }
                 break;
             }
@@ -745,7 +754,6 @@
 			*iNotifyReceiveModeChangePtr = iMobileSmsReceiveMode;
 			}
         ReqCompleted( reqHandle, KErrNone );
-        iNotifyReceiveModeChangePtr = NULL;
         }
     }
 
@@ -2787,9 +2795,6 @@
     switch ( aReqHandleType )
         {
         // SMS specific requests
-        case EMultimodeSmsSetReceiveMode:
-            timeOut = KMmSmsSetReceiveMode;
-            break;
         case EMultimodeSmsAckStored:
         case EMultimodeSmsNackStored:
             timeOut = KMmSmsAckNackMessage;