201039_01 PDK_4.0.a
authorhgs
Tue, 28 Sep 2010 20:14:08 +0800
changeset 52 866b4af7ffbe
parent 51 64200268cac2
child 54 4dc88a4ac6f4
child 60 841f70763fbe
201039_01
backupandrestore/backupengine/src/sbecompressionandencryption.cpp
backupandrestore/backupengine/src/sbedataowner.cpp
localconnectivityservice/dun/atext/inc/DunAtCmdHandler.h
localconnectivityservice/dun/atext/src/DunAtCmdEchoer.cpp
localconnectivityservice/dun/atext/src/DunAtCmdHandler.cpp
localconnectivityservice/dun/atext/src/DunAtCmdPusher.cpp
localconnectivityservice/dun/atext/src/DunAtEcomListen.cpp
localconnectivityservice/dun/atext/src/DunAtModeListen.cpp
localconnectivityservice/dun/atext/src/DunAtNvramListen.cpp
localconnectivityservice/dun/atext/src/DunAtUrcHandler.cpp
localconnectivityservice/dun/plugins/src/bt/DunBtListen.cpp
localconnectivityservice/dun/plugins/src/usb/DunUsbConfig.cpp
localconnectivityservice/dun/plugins/src/usb/DunUsbListen.cpp
localconnectivityservice/dun/utils/src/DunDataPusher.cpp
localconnectivityservice/dun/utils/src/DunDataWaiter.cpp
localconnectivityservice/dun/utils/src/DunDownstream.cpp
localconnectivityservice/dun/utils/src/DunSignalCopy.cpp
localconnectivityservice/dun/utils/src/DunSignalNotify.cpp
localconnectivityservice/dun/utils/src/DunSignalWaiter.cpp
localconnectivityservice/dun/utils/src/DunUpstream.cpp
mtpdataproviders/mtpimagedp/src/cmtpimagedpthumbnailcreator.cpp
mtpdataproviders/mtppictbridgedp/src/cmtppictbridgedpgetformatcapabilities.cpp
mtpdataproviders/mtppictbridgedp/src/cmtppictbridgedpgetobjectproplist.cpp
mtpfws/mtpfw/daemon/server/inc/cmtpserver.h
mtpfws/mtpfw/daemon/server/src/cmtpserver.cpp
mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetdevicepropdesc.cpp
mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetdevicepropvalue.cpp
mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetobjecthandles.cpp
mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetserviceinfo.cpp
mtpfws/mtpfw/dataproviders/devdp/src/cmtpresetdevicepropvalue.cpp
mtpfws/mtpfw/dataproviders/dputility/src/cmtpgetformatcapabilities.cpp
mtpfws/mtpfw/dataproviders/dputility/src/cmtpgetobjectproplist.cpp
mtpfws/mtpfw/dataproviders/dputility/src/cmtpgetpartialobject.cpp
mtpfws/mtpfw/dataproviders/proxydp/src/cmtpdeleteobjectproplist.cpp
mtpfws/mtpfw/dataproviders/proxydp/src/cmtpgetformatcapabilities.cpp
mtpfws/mtpfw/datatypes/src/cmtptypeserviceobjpropextnform.cpp
mtpfws/mtpfw/src/cmtpconnectionmgr.cpp
mtpfws/mtpfw/src/cmtpdeltadatamgr.cpp
mtpfws/mtpfw/src/cmtpframeworkconfig.cpp
mtpfws/mtpfw/src/cmtpobjectstore.cpp
mtpfws/mtpfw/src/cmtpreferencemgr.cpp
mtptransports/mtpptpiptransport/filterapi/interface/cptpiphostfilterinterface.h
mtptransports/mtpptpiptransport/ptpipcontroller/eabi/ptpipcontrolleru.def
mtptransports/mtpptpiptransport/ptpipcontroller/inc/cptpipcontroller.h
mtptransports/mtpptpiptransport/ptpipcontroller/src/cptpipcontroller.cpp
--- a/backupandrestore/backupengine/src/sbecompressionandencryption.cpp	Fri Sep 17 11:40:03 2010 +0800
+++ b/backupandrestore/backupengine/src/sbecompressionandencryption.cpp	Tue Sep 28 20:14:08 2010 +0800
@@ -126,7 +126,12 @@
 		if( ! iIsFreed )
 			iOffsetStart->Set(iActualStart);	// free reserved space when leave occurs.
 #endif
-		delete iCipher;
+		if( iCipher )
+		{
+			delete iCipher;
+			iCipher = NULL;
+		}
+		
 		OstTraceFunctionExit0( CSBECOMPRESSANDENCRYPT_CSBECOMPRESSANDENCRYPT_DES_EXIT );
 		}
 	
--- a/backupandrestore/backupengine/src/sbedataowner.cpp	Fri Sep 17 11:40:03 2010 +0800
+++ b/backupandrestore/backupengine/src/sbedataowner.cpp	Tue Sep 28 20:14:08 2010 +0800
@@ -2278,7 +2278,7 @@
 							{
 						    OstTrace0(TRACE_NORMAL, DUP4_CDATAOWNER_GETNEXTPUBLICFILEL, "parsing directory...");
 							RDir dir;
-							dir.Open(ipDataOwnerManager->GetRFs(), fileName, KEntryAttMaskSupported);
+							User::LeaveIfError(dir.Open(ipDataOwnerManager->GetRFs(), fileName, KEntryAttMaskSupported));
 							iPublicDirStack.AppendL(dir);
 							iPublicDirNameStack.AppendL(fileName.AllocL());
 							++stackCount;
--- a/localconnectivityservice/dun/atext/inc/DunAtCmdHandler.h	Fri Sep 17 11:40:03 2010 +0800
+++ b/localconnectivityservice/dun/atext/inc/DunAtCmdHandler.h	Tue Sep 28 20:14:08 2010 +0800
@@ -555,9 +555,13 @@
      *
      * @since TB9.2
      * @param aCharacter Character to test
+     * @param aBasic ETrue if basic check needed, EFalse otherwise
+     * @param aExtended ETrue if extended check needed, EFalse otherwise
      * @return ETrue if delimiter character, EFalse otherwise
      */
-    TBool IsDelimiterCharacter( TChar aCharacter );
+    TBool IsDelimiterCharacter( TChar aCharacter,
+                                TBool aBasic,
+                                TBool aExtended );
 
     /**
      * Checks if character is of extended group
@@ -608,7 +612,19 @@
      * @param aEndIndex End index (changes)
      * @return Symbian error code on error, KErrNone otherwise
      */
-    TBool FindSubCommandQuotes( TChar aCharacter, TInt aStartIndex, TInt& aEndIndex );
+    TBool FindSubCommandQuotes( TChar aCharacter,
+                                TInt aStartIndex,
+                                TInt& aEndIndex );
+
+    /**
+     * Check if in basic command delimiter skip zone
+     *
+     * @since TB9.2
+     * @param aCharacter Character to check
+     * @param aEndIndex End index (changes)
+     * @return Symbian error code on error, KErrNone otherwise
+     */
+    TBool IsBasicDelimiterSkipZone( TChar aCharacter, TInt& aEndIndex );
 
     /**
      * Check if in next subcommand's extended border
@@ -619,7 +635,9 @@
      * @param aEndIndex End index (changes)
      * @return ETrue if in next command's extended border, EFalse otherwise
      */
-    TBool IsExtendedBorder( TChar aCharacter, TInt aStartIndex, TInt& aEndIndex );
+    TBool IsExtendedBorder( TChar aCharacter,
+                            TInt aStartIndex,
+                            TInt& aEndIndex );
 
     /**
      * Finds subcommand with alphanumeric borders
--- a/localconnectivityservice/dun/atext/src/DunAtCmdEchoer.cpp	Fri Sep 17 11:40:03 2010 +0800
+++ b/localconnectivityservice/dun/atext/src/DunAtCmdEchoer.cpp	Tue Sep 28 20:14:08 2010 +0800
@@ -70,9 +70,9 @@
         FTRACE(FPrint( _L("CDunAtCmdEchoer::SendEchoCharacter() (not ready) complete") ));
         return KErrNotReady;
         }
+    iAtEchoState = EDunStateAtCmdEchoing;
     iStreamCallback->NotifyDataPushRequest( aInput, this );
     iCallback = aCallback;
-    iAtEchoState = EDunStateAtCmdEchoing;
     FTRACE(FPrint( _L("CDunDownstream::SendEchoCharacter() complete" ) ));
     return KErrNone;
     }
--- a/localconnectivityservice/dun/atext/src/DunAtCmdHandler.cpp	Fri Sep 17 11:40:03 2010 +0800
+++ b/localconnectivityservice/dun/atext/src/DunAtCmdHandler.cpp	Tue Sep 28 20:14:08 2010 +0800
@@ -53,6 +53,11 @@
  * Refer to test specification if planning to change the heuristic.
  * Note2: Input buffer management (ExtractLineFromInputBuffer()) can be tested
  * with non-line based terminals such as HyperTerminal or Realterm.
+ * Note3: If there is a need to handle commands with random data, the extended
+ * command checking can interfere with the character set of this random data.
+ * Best way to handle this random data is to create a handler for these commands
+ * which skips the valid "not to be parsed" data or use quotes. For these cases
+ * the CDunAtSpecialCmdHandler could be extended.
  */
 
 #include "DunAtCmdHandler.h"
@@ -978,7 +983,7 @@
     for ( TInt i=aStartIndex; i<inputLength; i++ )
         {
         TChar character = (*iInput)[i];
-        if ( !IsDelimiterCharacter(character) )
+        if ( !IsDelimiterCharacter(character,ETrue,ETrue) )
             {
             foundIndex = i;
             break;
@@ -1162,6 +1167,8 @@
         iDecodeInfo.iCmdsHandled++;
         FTRACE(FPrint( _L("CDunAtCmdHandler::ExtractNextSubCommand() (handled=%d)"), iDecodeInfo.iCmdsHandled ));
         }
+    FTRACE(FPrint( _L("CDunAtCmdPusher::ExtractNextSubCommand() extracted:") ));
+    FTRACE(FPrintRaw(iParseInfo.iSendBuffer) );
     FTRACE(FPrint( _L("CDunAtCmdHandler::ExtractNextSubCommand() complete") ));
     return ETrue;
     }
@@ -1179,7 +1186,7 @@
     for ( i=iDecodeInfo.iDecodeIndex; i<lineLength; i++ )
         {
         TChar character = iLineBuffer[i];
-        if ( !IsDelimiterCharacter(character) )
+        if ( !IsDelimiterCharacter(character,ETrue,ETrue) )
             {
             foundIndex = i;
             break;
@@ -1226,14 +1233,21 @@
 // Checks if character is delimiter character
 // ---------------------------------------------------------------------------
 //
-TBool CDunAtCmdHandler::IsDelimiterCharacter( TChar aCharacter )
+TBool CDunAtCmdHandler::IsDelimiterCharacter( TChar aCharacter,
+                                              TBool aBasic,
+                                              TBool aExtended )
     {
     FTRACE(FPrint( _L("CDunAtCmdHandler::IsDelimiterCharacter()") ));
-    if ( aCharacter.IsSpace() || aCharacter==';' || aCharacter==0x00 )
+   if ( aBasic && ( aCharacter.IsSpace()||aCharacter==0x00) )
         {
         FTRACE(FPrint( _L("CDunAtCmdHandler::IsDelimiterCharacter() complete") ));
         return ETrue;
         }
+   if ( aExtended && aCharacter == ';' )
+        {
+        FTRACE(FPrint( _L("CDunAtCmdHandler::IsDelimiterCharacter() (extended) complete") ));
+        return ETrue;
+        }
     FTRACE(FPrint( _L("CDunAtCmdHandler::IsDelimiterCharacter() (not delimiter) complete") ));
     return EFalse;
     }
@@ -1245,6 +1259,16 @@
 TBool CDunAtCmdHandler::IsExtendedCharacter( TChar aCharacter )
     {
     FTRACE(FPrint( _L("CDunAtCmdHandler::IsExtendedCharacter()") ));
+    // Extended characters supported by this function (parser understands these)
+    // '+': Universal; mentioned in 3GPP TS 27.007, 3GPP TS 27.005, ITU-T V.250
+    // '&': Mentioned in ITU-T V.250 and in some "de facto" commands
+    // '%': Used by some old Hayes modems, left just in case
+    // '\': Used by some old Hayes modems, left just in case
+    // '*': Used by some old Hayes modems, AT&T and others
+    // '#': Used by some old Hayes modems, left just in case
+    // '$': Used by AT&T and Qualcomm
+    // '^': Used by China Mobile
+    // [please maintain this list here for quick reference]
     if ( aCharacter=='+'  || aCharacter=='&' || aCharacter=='%' ||
          aCharacter=='\\' || aCharacter=='*' || aCharacter=='#' ||
          aCharacter=='$'  || aCharacter=='^' )
@@ -1381,6 +1405,46 @@
     }
 
 // ---------------------------------------------------------------------------
+// Check if in basic command delimiter skip zone
+// ---------------------------------------------------------------------------
+//
+TBool CDunAtCmdHandler::IsBasicDelimiterSkipZone( TChar aCharacter,
+                                                  TInt& aEndIndex )
+    {
+    FTRACE(FPrint( _L("CDunAtCmdHandler::IsBasicDelimiterSkipZone()") ));
+    if ( !IsDelimiterCharacter(aCharacter,ETrue,EFalse) )
+        {
+        FTRACE(FPrint( _L("CDunAtCmdHandler::IsBasicDelimiterSkipZone() complete") ));
+        return EFalse;
+        }
+    // Check the case after '='
+    if ( iDecodeInfo.iAssignFound )
+        {
+        FTRACE(FPrint( _L("CDunAtCmdHandler::IsBasicDelimiterSkipZone() (after =) complete") ));
+        return ETrue;
+        }
+    // Check the case before '='
+    TInt peekIndex = aEndIndex + 1;
+    TInt lineLength = iLineBuffer.Length();
+    for ( ; peekIndex<lineLength; peekIndex++ )
+        {
+        TChar peekCharacter = iLineBuffer[peekIndex];
+        if ( peekCharacter=='?' || peekCharacter=='=' )
+            {
+            aEndIndex = peekIndex;
+            FTRACE(FPrint( _L("CDunAtCmdHandler::IsBasicDelimiterSkipZone() (? or =) complete") ));
+            return ETrue;
+            }
+        if ( !IsDelimiterCharacter(peekCharacter,ETrue,EFalse) )
+            {
+            break;
+            }
+        }
+    FTRACE(FPrint( _L("CDunAtCmdHandler::IsBasicDelimiterSkipZone() complete") ));
+    return EFalse;
+    }
+
+// ---------------------------------------------------------------------------
 // Check if in next subcommand's extended border
 // ---------------------------------------------------------------------------
 //
@@ -1436,7 +1500,8 @@
         // Check the special case when assigning a number with "basic" command
         // and there is no delimiter after it. In this case <Numeric>|<Alpha>
         // border must be detected but only for a "basic" command, not for
-        // extended.
+        // extended. This type of case is in active use in initialization
+        // strings where "ATS7=60L1M1X3" is one example
         if ( iDecodeInfo.iExtendedIndex<0    && iDecodeInfo.iPrevExists &&
              iDecodeInfo.iPrevChar.IsDigit() && aCharacter.IsAlpha() )
             {
@@ -1497,6 +1562,7 @@
     TInt startIndex = iDecodeInfo.iDecodeIndex;
     aEndIndex = startIndex;
     TBool found = EFalse;
+    TBool skipZone = EFalse;
     TInt lineLength = iLineBuffer.Length();
     iDecodeInfo.iAssignFound = EFalse;
     iDecodeInfo.iInQuotes = EFalse;
@@ -1506,11 +1572,22 @@
     for ( ; aEndIndex<lineLength; aEndIndex++ )
         {
         TChar character = iLineBuffer[aEndIndex];
+        // Skip '=', quotes and data in quotes
         found = FindSubCommandQuotes( character, startIndex, aEndIndex );
         if ( found )
             {
             continue;
             }
+        // Skip basic command delimiter in the following cases:
+        // "ATCOMMAND    ?"
+        // "AT+COMMAND   ="
+        // "AT+COMMAND=PARAM1,     PARAM2"
+        skipZone = IsBasicDelimiterSkipZone( character, aEndIndex );
+        if ( skipZone )
+            {
+            continue;
+            }
+        // If '?', stop immediately
         if ( character == '?' )
             {
             FTRACE(FPrint( _L("CDunAtCmdHandler::FindSubCommand() (?) complete") ));
@@ -1518,7 +1595,7 @@
             }
         // The check below detects the following type of cases:
         // ATCMD<delimiter>
-        if ( IsDelimiterCharacter(character) )
+        if ( IsDelimiterCharacter(character,ETrue,ETrue) )
             {
             aEndIndex--;
             FTRACE(FPrint( _L("CDunAtCmdHandler::FindSubCommand() (delimiter) complete") ));
--- a/localconnectivityservice/dun/atext/src/DunAtCmdPusher.cpp	Fri Sep 17 11:40:03 2010 +0800
+++ b/localconnectivityservice/dun/atext/src/DunAtCmdPusher.cpp	Tue Sep 28 20:14:08 2010 +0800
@@ -119,13 +119,13 @@
         return KErrGeneral;
         }
     iStatus = KRequestPending;
+    iAtPushState = EDunStateAtCmdPushing;
     iAtCmdExt->HandleCommand( iStatus,
                               aInput,
                               iRecvBuffer,
                               iReplyLeftPckg,
                               iReplyTypePckg );
     SetActive();
-    iAtPushState = EDunStateAtCmdPushing;
     FTRACE(FPrint( _L("CDunAtCmdPusher::IssueRequest() complete") ));
     return KErrNone;
     }
--- a/localconnectivityservice/dun/atext/src/DunAtEcomListen.cpp	Fri Sep 17 11:40:03 2010 +0800
+++ b/localconnectivityservice/dun/atext/src/DunAtEcomListen.cpp	Tue Sep 28 20:14:08 2010 +0800
@@ -86,9 +86,9 @@
         return KErrNotReady;
         }
     iStatus = KRequestPending;
+    iEcomListenState = EDunStateEcomListening;
     iAtCmdExt->ReceiveEcomPluginChange( iStatus, iPluginUidPckg, iEcomTypePckg );
     SetActive();
-    iEcomListenState = EDunStateEcomListening;
     FTRACE(FPrint( _L("CDunAtEcomListen::IssueRequest() complete") ));
     return KErrNone;
     }
--- a/localconnectivityservice/dun/atext/src/DunAtModeListen.cpp	Fri Sep 17 11:40:03 2010 +0800
+++ b/localconnectivityservice/dun/atext/src/DunAtModeListen.cpp	Tue Sep 28 20:14:08 2010 +0800
@@ -84,9 +84,9 @@
         return KErrNotReady;
         }
     iStatus = KRequestPending;
+    iModeListenState = EDunStateModeListening;
     iAtCmdExtCommon->ReceiveModeStatusChange( iStatus, iModePckg );
     SetActive();
-    iModeListenState = EDunStateModeListening;
     FTRACE(FPrint( _L("CDunAtModeListen::IssueRequest() complete" )));
     return KErrNone;
     }
@@ -179,4 +179,6 @@
 //
 void CDunAtModeListen::DoCancel()
     {
+    FTRACE(FPrint( _L("CDunAtModeListen::DoCancel()") ));
+    FTRACE(FPrint( _L("CDunAtModeListen::DoCancel() complete") ));
     }
--- a/localconnectivityservice/dun/atext/src/DunAtNvramListen.cpp	Fri Sep 17 11:40:03 2010 +0800
+++ b/localconnectivityservice/dun/atext/src/DunAtNvramListen.cpp	Tue Sep 28 20:14:08 2010 +0800
@@ -91,9 +91,9 @@
         iStarted = ETrue;
         }
     iStatus = KRequestPending;
+    iNvramHandleState = EDunStateNvramListening;
     iAtCmdExtCommon->ReceiveNvramStatusChange( iStatus, iNvramBuffer );
     SetActive();
-    iNvramHandleState = EDunStateNvramListening;
     FTRACE(FPrint( _L("CDunAtNvramListen::IssueRequest() complete") ));
     return KErrNone;
     }
--- a/localconnectivityservice/dun/atext/src/DunAtUrcHandler.cpp	Fri Sep 17 11:40:03 2010 +0800
+++ b/localconnectivityservice/dun/atext/src/DunAtUrcHandler.cpp	Tue Sep 28 20:14:08 2010 +0800
@@ -90,9 +90,9 @@
         return KErrNotReady;
         }
     iStatus = KRequestPending;
+    iUrcHandleState = EDunStateAtUrcHandling;
     iAtCmdExt->ReceiveUnsolicitedResult( iStatus, iRecvBuffer, iOwnerUidPckg );
     SetActive();
-    iUrcHandleState = EDunStateAtUrcHandling;
     // Next mark ownership
     if ( !iStarted )
         {
@@ -213,6 +213,8 @@
 //
 void CDunAtUrcHandler::DoCancel()
     {
+    FTRACE(FPrint( _L("CDunAtUrcHandler::DoCancel()") ));
+    FTRACE(FPrint( _L("CDunAtUrcHandler::DoCancel() complete") ));
     }
 
 // ---------------------------------------------------------------------------
--- a/localconnectivityservice/dun/plugins/src/bt/DunBtListen.cpp	Fri Sep 17 11:40:03 2010 +0800
+++ b/localconnectivityservice/dun/plugins/src/bt/DunBtListen.cpp	Tue Sep 28 20:14:08 2010 +0800
@@ -142,9 +142,9 @@
         User::Leave( retTemp );
         }
     iStatus = KRequestPending;
+    iListenState = EBtListenStateListening;
     iListenSocket.Accept( iEntity.iBTPort, iStatus );
     SetActive();
-    iListenState = EBtListenStateListening;
 
     FTRACE(FPrint( _L( "CDunBtListen::IssueRequestL() complete") ));
     }
--- a/localconnectivityservice/dun/plugins/src/usb/DunUsbConfig.cpp	Fri Sep 17 11:40:03 2010 +0800
+++ b/localconnectivityservice/dun/plugins/src/usb/DunUsbConfig.cpp	Tue Sep 28 20:14:08 2010 +0800
@@ -117,9 +117,9 @@
         return KErrNotReady;
         }
     iStatus = KRequestPending;
+    iConfigState = EUsbConfigStateWaiting;
     iAcmProperty.Subscribe( iStatus );
     SetActive();
-    iConfigState = EUsbConfigStateWaiting;
     FTRACE(FPrint( _L("CDunUsbConfig::IssueRequest() complete" )));
     return KErrNone;
     }
--- a/localconnectivityservice/dun/plugins/src/usb/DunUsbListen.cpp	Fri Sep 17 11:40:03 2010 +0800
+++ b/localconnectivityservice/dun/plugins/src/usb/DunUsbListen.cpp	Tue Sep 28 20:14:08 2010 +0800
@@ -182,11 +182,11 @@
         }
     iDeviceStatePrev = iDeviceState;
     iStatus = KRequestPending;
+    iListenState = EUsbListenStateListening;
     iUsbServer.DeviceStateNotification( KDunUsbDeviceStateMask,
                                         iDeviceState,
                                         iStatus );
     SetActive();
-    iListenState = EUsbListenStateListening;
     FTRACE(FPrint( _L( "CDunUsbListen::Activate() complete" ) ));
     return KErrNone;
     }
--- a/localconnectivityservice/dun/utils/src/DunDataPusher.cpp	Fri Sep 17 11:40:03 2010 +0800
+++ b/localconnectivityservice/dun/utils/src/DunDataPusher.cpp	Tue Sep 28 20:14:08 2010 +0800
@@ -194,7 +194,6 @@
         FTRACE(FPrint( _L("CDunDataPusher::SendQueuedData() (ERROR) complete" )));
         return EFalse;
         }
-    iPushState = EDunStateDataPushing;
     FTRACE(FPrint( _L("CDunDataPusher::SendQueuedData() complete (%d)" ), iEventQueue.Count() ));
     return ETrue;
     }
@@ -338,21 +337,24 @@
     if ( iComm )
         {
         iStatus = KRequestPending;
+        iPushState = EDunStateDataPushing;
         iComm->Write( iStatus, *dataToPush );
-        FTRACE(FPrint( _L("CDunDataPusher::ManageOneEvent() RComm Write() requested (buffer=0x%08X)" ), dataToPush ));
+        SetActive();
+        FTRACE(FPrint( _L("CDunDataPusher::ManageOneEvent() RComm Write() requested for %d bytes... (buffer=0x%08X)" ), dataToPush->Length(), dataToPush ));
         }
     else if ( iSocket )
         {
         iStatus = KRequestPending;
+        iPushState = EDunStateDataPushing;
         iSocket->Send( *dataToPush, 0, iStatus );
-        FTRACE(FPrint( _L("CDunDataPusher::ManageOneEvent() RSocket Send() requested (buffer=0x%08X)" ), dataToPush ));
+        SetActive();
+        FTRACE(FPrint( _L("CDunDataPusher::ManageOneEvent() RSocket Send() requested for %d bytes... (buffer=0x%08X)" ), dataToPush->Length(), dataToPush ));
         }
     else
         {
         FTRACE(FPrint( _L("CDunDataPusher::ManageOneEvent() (ERROR) complete" )));
         return KErrGeneral;
         }
-    SetActive();
     FTRACE(FPrint( _L("CDunDataPusher::ManageOneEvent() complete" )));
     return KErrNone;
     }
@@ -412,6 +414,7 @@
         }  // if ( !stop )
     else  // stop -> tear down connection
         {
+        iPushState = EDunStateIdle;
         TDunConnectionReason connReason;
         connReason.iReasonType = EDunReasonTypeRW;
         connReason.iContext = EDunMediaContextLocal;
--- a/localconnectivityservice/dun/utils/src/DunDataWaiter.cpp	Fri Sep 17 11:40:03 2010 +0800
+++ b/localconnectivityservice/dun/utils/src/DunDataWaiter.cpp	Tue Sep 28 20:14:08 2010 +0800
@@ -134,11 +134,11 @@
         FTRACE(FPrint( _L("CDunDataWaiter::IssueRequest() (iComm) not initialized!" ) ));
         return KErrGeneral;
         }
+    iComm->ResetBuffers();
     iStatus = KRequestPending;
-    iComm->ResetBuffers();
+    iDataWaiterState = EDunStateDataWaiting;
     iComm->NotifyDataAvailable( iStatus );
     SetActive();
-    iDataWaiterState = EDunStateDataWaiting;
     FTRACE(FPrint( _L("CDunDataWaiter::IssueRequest() complete" )));
     return KErrNone;
     }
--- a/localconnectivityservice/dun/utils/src/DunDownstream.cpp	Fri Sep 17 11:40:03 2010 +0800
+++ b/localconnectivityservice/dun/utils/src/DunDownstream.cpp	Tue Sep 28 20:14:08 2010 +0800
@@ -222,6 +222,7 @@
         iPushData.iDataPusher->StopOneEvent( iBufferPtr );
         }
     iTransferState = EDunStateIdle;
+    iOperationType = EDunOperationTypeUndefined;
     FTRACE(FPrint( _L("CDunDownstream::Stop() complete" )));
     return KErrNone;
     }
@@ -298,11 +299,13 @@
         {
         case EDunReaderDownstream:
             iStatus = KRequestPending;
+            iTransferState = EDunStateTransferring;
             iNetwork->ReadOneOrMore( iStatus, *iBufferPtr );
             SetActive();
             FTRACE(FPrint( _L("CDunDownstream::IssueRequest() RComm ReadOneOrMore() requested" ) ));
             break;
         case EDunWriterDownstream:
+            iTransferState = EDunStateTransferring;
             AddToQueueAndSend( iBufferPtr, this );
             break;
         default:
@@ -310,8 +313,6 @@
             return KErrGeneral;
         }
 
-    iTransferState = EDunStateTransferring;
-
     FTRACE(FPrint( _L("CDunDownstream::IssueRequest() (Dir=%d) complete" ), iDirection));
     return KErrNone;
     }
@@ -374,6 +375,8 @@
 //
 void CDunDownstream::DoCancel()
     {
+    FTRACE(FPrint( _L("CDunDownstream::DoCancel()" )));
+    FTRACE(FPrint( _L("CDunDownstream::DoCancel() complete" )));
     }
 
 // ---------------------------------------------------------------------------
@@ -407,8 +410,6 @@
         FTRACE(FPrint( _L("CDunDownstream::NotifyDataPushComplete() (continue) complete" )));
         return;
         }
-    iTransferState = EDunStateIdle;
-    iOperationType = EDunOperationTypeUndefined;
     if ( !iPushData.iDataPusher )
         {
         FTRACE(FPrint( _L("CDunDownstream::NotifyDataPushComplete() (iPushData.iDataPusher not initialized!) complete" )));
@@ -423,7 +424,8 @@
     FTRACE(FPrint( _L("CDunDownstream::NotifyDataPushComplete() (find event)" )));
     if ( foundIndex >= 0 )
         {
-        // Restart the reading from Dataport only if in data mode
+        iTransferState = EDunStateIdle;
+        iOperationType = EDunOperationTypeUndefined;
         FTRACE(FPrint( _L("CDunDownstream::NotifyDataPushComplete() (issue request)" )));
         if ( iPushData.iDataMode )
             {
@@ -443,9 +445,10 @@
     {
     FTRACE(FPrint( _L("CDunDownstream::NotifyCommandModeStart()" )));
     iPushData.iDataMode = EFalse;
-    // Now the data mode has ended.
-    // If read operation then cancel it.
-    if ( iOperationType == EDunOperationTypeRead )
+    // Now the data mode has ended. If read operation then cancel it.
+    // Check for iTransferState here to minimize logging
+    if ( iTransferState==EDunStateTransferring &&
+         iOperationType==EDunOperationTypeRead )
         {
         Stop( EFalse );
         }
@@ -461,8 +464,14 @@
     {
     FTRACE(FPrint( _L("CDunDownstream::NotifyCommandModeEnd()" )));
     iPushData.iDataMode = ETrue;
-    // Command mode ends here so start reading from Dataport
-    iOperationType = EDunOperationTypeRead;
-    IssueRequest();
+    // Command mode ends here so start reading from Dataport only if generic
+    // transferring state is not EDunStateIdle. This is a reduced form of having
+    // read pending -> reissue not needed OR write pending -> reissue not needed
+    // (NotifyDataPushComplete() will reissue).
+    if ( iTransferState == EDunStateIdle )
+        {
+        iOperationType = EDunOperationTypeRead;  // just in case
+        IssueRequest();
+        }
     FTRACE(FPrint( _L("CDunDownstream::NotifyCommandModeEnd() complete" )));
     }
--- a/localconnectivityservice/dun/utils/src/DunSignalCopy.cpp	Fri Sep 17 11:40:03 2010 +0800
+++ b/localconnectivityservice/dun/utils/src/DunSignalCopy.cpp	Tue Sep 28 20:14:08 2010 +0800
@@ -192,9 +192,9 @@
         {
         FTRACE(FPrint( _L("CDunSignalCopy::IssueRequest() start waiting for change..." ) ));
         iStatus = KRequestPending;
+        iSignalCopyState = EDunStateSignalCopy;
         comm->NotifySignalChange( iStatus, iSignals, iListenSignals );
         SetActive();
-        iSignalCopyState = EDunStateSignalCopy;
         }
     FTRACE(FPrint( _L("CDunSignalCopy::IssueRequest() complete" )));
     return KErrNone;
--- a/localconnectivityservice/dun/utils/src/DunSignalNotify.cpp	Fri Sep 17 11:40:03 2010 +0800
+++ b/localconnectivityservice/dun/utils/src/DunSignalNotify.cpp	Tue Sep 28 20:14:08 2010 +0800
@@ -165,9 +165,9 @@
         {
         FTRACE(FPrint( _L("CDunSignalNotify::IssueRequest() start waiting for change..." ) ));
         iStatus = KRequestPending;
+        iSignalNotifyState = EDunStateSignalNotify;
         iNetwork->NotifySignalChange( iStatus, iSignals, iListenSignals );
         SetActive();
-        iSignalNotifyState = EDunStateSignalNotify;
         }
     FTRACE(FPrint( _L("CDunSignalNotify::IssueRequest() complete" )));
     return KErrNone;
@@ -382,4 +382,6 @@
 //
 void CDunSignalNotify::DoCancel()
     {
+    FTRACE(FPrint( _L("CDunSignalNotify::DoCancel()" ) ));
+    FTRACE(FPrint( _L("CDunSignalNotify::DoCancel() complete" ) ));
     }
--- a/localconnectivityservice/dun/utils/src/DunSignalWaiter.cpp	Fri Sep 17 11:40:03 2010 +0800
+++ b/localconnectivityservice/dun/utils/src/DunSignalWaiter.cpp	Tue Sep 28 20:14:08 2010 +0800
@@ -141,9 +141,9 @@
         return KErrGeneral;
         }
     iStatus = KRequestPending;
+    iSignalWaiterState = EDunStateSignalWaiting;
     iComm->NotifySignalChange( iStatus, iSignals, KSignalDCEInputs );
     SetActive();
-    iSignalWaiterState = EDunStateSignalWaiting;
     FTRACE(FPrint( _L("CDunSignalWaiter::IssueRequest() complete" )));
     return KErrNone;
     }
--- a/localconnectivityservice/dun/utils/src/DunUpstream.cpp	Fri Sep 17 11:40:03 2010 +0800
+++ b/localconnectivityservice/dun/utils/src/DunUpstream.cpp	Tue Sep 28 20:14:08 2010 +0800
@@ -121,6 +121,12 @@
         FTRACE(FPrint( _L("CDunUpstream::InitializeForAtParsing() (trapped!) complete" ) ));
         return retTrap;
         }
+    // Note: the order of the added callbacks is important. When a mode change
+    // occurs, it is best to do the most important stuff with the first callback
+    // object and after this cleanups with the second. Example: Data mode start
+    // should stop command handling; first callback stops command handling,
+    // second callback stops multiplexer (doing this differently could cause the
+    // multiplexer to re-activate).
     atCmdHandler->AddCmdModeCallback( aCallbackUp );
     atCmdHandler->AddCmdModeCallback( aCallbackDown );
     iParseData.iDataMode = EFalse;
@@ -189,6 +195,7 @@
         }
     Cancel();
     iTransferState = EDunStateIdle;
+    iOperationType = EDunOperationTypeUndefined;
     // Notify parent about inactivity
     if ( iActivityData.iActivityCallback && iActivityData.iNotified )
         {
@@ -279,13 +286,17 @@
             if ( iComm )
                 {
                 iStatus = KRequestPending;
+                iTransferState = EDunStateTransferring;
                 iComm->ReadOneOrMore( iStatus, *iBufferPtr );
+                SetActive();
                 FTRACE(FPrint( _L("CDunUpstream::IssueRequest() RComm ReadOneOrMore() requested" ) ));
                 }
             else if ( iSocket )
                 {
                 iStatus = KRequestPending;
+                iTransferState = EDunStateTransferring;
                 iSocket->RecvOneOrMore( *iBufferPtr, 0, iStatus, iReadLengthSocket );
+                SetActive();
                 FTRACE(FPrint( _L("CDunUpstream::IssueRequest() RSocket RecvOneOrMore() requested" ) ));
                 }
             else
@@ -296,7 +307,9 @@
             break;
         case EDunWriterUpstream:
             iStatus = KRequestPending;
+            iTransferState = EDunStateTransferring;
             iNetwork->Write( iStatus, *iBufferPtr );
+            SetActive();
             FTRACE(FPrint( _L("CDunUpstream::IssueRequest() RComm Write() requested" ) ));
             break;
         default:
@@ -304,9 +317,6 @@
             return KErrGeneral;
         }
 
-    SetActive();
-    iTransferState = EDunStateTransferring;
-
     FTRACE(FPrint( _L("CDunUpstream::IssueRequest() (Dir=%d) complete" ), iDirection));
     return KErrNone;
     }
@@ -440,6 +450,8 @@
 //
 void CDunUpstream::DoCancel()
     {
+    FTRACE(FPrint( _L("CDunUpstream::DoCancel()" )));
+    FTRACE(FPrint( _L("CDunUpstream::DoCancel() complete" )));
     }
 
 // ---------------------------------------------------------------------------
@@ -450,6 +462,11 @@
 void CDunUpstream::NotifyParserNeedsMoreData()
     {
     FTRACE(FPrint( _L("CDunUpstream::NotifyParserNeedsMoreData()" )));
+    if ( iOperationType != EDunOperationTypeRead )
+        {
+        FTRACE(FPrint( _L("CDunUpstream::NotifyParserNeedsMoreData() (not ready) complete" )));
+        return;
+        }
     IssueRequest();  // iOperationType must be read here (don't set)
     FTRACE(FPrint( _L("CDunUpstream::NotifyParserNeedsMoreData() complete" )));
     }
@@ -550,15 +567,12 @@
     iParseData.iDataMode = ETrue;
     // Stop processing (mandatory).
     // This will stop any possibly pending operations of
-    // CDunAtCmdHandler and CDunAtUrcHandler. CDunDownstream will take care of
-    // clearing (and stopping) non-callback write queues.
+    // CDunAtCmdHandler and CDunAtUrcHandler(s). CDunDownstream will take care
+    // of clearing (and stopping) non-callback write queues.
     StopAtCmdHandling();
-    // The follow is needed because stopping the AT command handling here
-    // prevents the subsequent AT command handling notification to reach the
-    // NotifyAtCmdHandlingEnd() in this class (the notification starts from
-    // CDunAtCmdPusher's SetToIdleAndNotifyEnd()).
-    // So here we have to do the block "if ( aStartIndex < 0 )" in function
-    // NotifyAtCmdHandlingEnd().
+    // The following is needed here because stopping the AT command handling
+    // causes CDunAtCmdHandler not to call NotifyParserNeedsMoreData().
+    // In command mode iOperationType is always EDunOperationTypeRead.
     IssueRequest();
     FTRACE(FPrint( _L("CDunUpstream::NotifyCommandModeEnd() complete" )));
     }
@@ -571,6 +585,7 @@
 void CDunUpstream::NotifyEchoComplete()
     {
     FTRACE(FPrint( _L("CDunUpstream::NotifyEchoComplete()" )));
+    // iOperationType is always EDunOperationTypeRead here
     IssueRequest();
     FTRACE(FPrint( _L("CDunUpstream::NotifyEchoComplete() complete" )));
     }
--- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpthumbnailcreator.cpp	Fri Sep 17 11:40:03 2010 +0800
+++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpthumbnailcreator.cpp	Tue Sep 28 20:14:08 2010 +0800
@@ -65,20 +65,36 @@
         {
         iThumbMgr->CancelRequest(iCurrentReq);
         }
+    
     delete iData;
+    iData = NULL;
+    	
     delete iImgEnc;
+    iImgEnc = NULL;
+    
 #ifdef MTPTHUMBSCALING
     delete iScaler;
+    iScaler = NULL;
 #endif
+    
     delete iBitmap;  
+    iBitmap = NULL;  
+    
     delete iObjectSource;
+    iObjectSource = NULL;
+    	
     delete iThumbMgr;
+    iThumbMgr = NULL;
+    
     if(iActiveSchedulerWait != NULL && iActiveSchedulerWait->IsStarted())
         {
         *iCreationErr = KErrNotReady;
         iActiveSchedulerWait->AsyncStop();
         }
+    
     delete iActiveSchedulerWait;
+    iActiveSchedulerWait = NULL;
+    
     OstTraceFunctionExit0( CMTPIMAGEDPTHUMBNAILCREATOR_CMTPIMAGEDPTHUMBNAILCREATOR_DES_EXIT );
     }
  
@@ -183,6 +199,7 @@
                         "CMTPImageDpThumbnailCreator::RunL(),EDoNotCreate; iState %d", iState );
                 
                 delete iData;
+                iData = NULL;
                 iData = HBufC8::NewL(1);
                 }
 
--- a/mtpdataproviders/mtppictbridgedp/src/cmtppictbridgedpgetformatcapabilities.cpp	Fri Sep 17 11:40:03 2010 +0800
+++ b/mtpdataproviders/mtppictbridgedp/src/cmtppictbridgedpgetformatcapabilities.cpp	Tue Sep 28 20:14:08 2010 +0800
@@ -56,6 +56,7 @@
     {
     __FLOG(_L8(">> CMTPPictBridgeDpGetFormatCapabilities::ServiceL"));
     delete iCapabilityList;
+    iCapabilityList = NULL;
     iCapabilityList = CMTPTypeFormatCapabilityList::NewL();
     iFormatCode = Request().Uint32(TMTPTypeRequest::ERequestParameter1);
     BuildFormatScriptL();
--- a/mtpdataproviders/mtppictbridgedp/src/cmtppictbridgedpgetobjectproplist.cpp	Fri Sep 17 11:40:03 2010 +0800
+++ b/mtpdataproviders/mtppictbridgedp/src/cmtppictbridgedpgetobjectproplist.cpp	Tue Sep 28 20:14:08 2010 +0800
@@ -255,6 +255,7 @@
     CleanupClosePushL( handles );
 
     delete iHandles;
+    iHandles = NULL;
     iHandles = CMTPTypeArray::NewL( EMTPTypeAUINT32 );
 
     do
@@ -284,6 +285,7 @@
     else if ( 0 == aDepth )
         {
         delete iHandles;
+        iHandles = NULL;
         iHandles = CMTPTypeArray::NewL( EMTPTypeAUINT32 );    //empty array
         }
     else
--- a/mtpfws/mtpfw/daemon/server/inc/cmtpserver.h	Fri Sep 17 11:40:03 2010 +0800
+++ b/mtpfws/mtpfw/daemon/server/inc/cmtpserver.h	Tue Sep 28 20:14:08 2010 +0800
@@ -61,6 +61,11 @@
     The MTP framework singletons.
     */
     RMTPFramework   iFrameworkSingletons;
+    
+    /**
+    Flag for the MTP framework singletons.
+    **/
+    TBool   iFrameworkSingletonsOpened;
 	
 	/**
 	The active MTP client API session count.
--- a/mtpfws/mtpfw/daemon/server/src/cmtpserver.cpp	Fri Sep 17 11:40:03 2010 +0800
+++ b/mtpfws/mtpfw/daemon/server/src/cmtpserver.cpp	Tue Sep 28 20:14:08 2010 +0800
@@ -77,9 +77,12 @@
     OstTraceFunctionEntry0( CMTPSERVER_CMTPSERVER_DES_ENTRY ); 
     delete iShutdown;
     iShutdown = NULL;
-    iFrameworkSingletons.ConnectionMgr().StopTransports();
-    iFrameworkSingletons.DpController().UnloadDataProviders();
-    iFrameworkSingletons.Close();
+    if(iFrameworkSingletonsOpened)
+        {
+        iFrameworkSingletons.ConnectionMgr().StopTransports();
+        iFrameworkSingletons.DpController().UnloadDataProviders();
+        iFrameworkSingletons.Close();	    
+        }
     REComSession::FinalClose();
     OstTraceFunctionExit0( CMTPSERVER_CMTPSERVER_DES_EXIT );
     }
@@ -192,6 +195,7 @@
     OstTraceFunctionEntry0( CMTPSERVER_CONSTRUCTL_ENTRY );
     StartL(KMTPServerName);
     iFrameworkSingletons.OpenL();
+    iFrameworkSingletonsOpened = ETrue;
     if (!iShutdown)
         {
         TRAPD(error, iShutdown = CMTPShutdown::NewL());
--- a/mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetdevicepropdesc.cpp	Fri Sep 17 11:40:03 2010 +0800
+++ b/mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetdevicepropdesc.cpp	Tue Sep 28 20:14:08 2010 +0800
@@ -422,9 +422,11 @@
     iPropDesc = CMTPTypeDevicePropDesc::NewL(EMTPDevicePropCodeFunctionalID, 1, 0, NULL); 
     
     delete iData;
+    iData = NULL;
 	iData = GetGUIDL( MMTPFrameworkConfig::EDeviceDefaultFuncationalID ); 
 	iPropDesc->SetL(CMTPTypeDevicePropDesc::EFactoryDefaultValue, *iData);
 	delete iData;
+	iData = NULL;
 	iData = GetGUIDL(MMTPFrameworkConfig::EDeviceCurrentFuncationalID); 
 	iPropDesc->SetL(CMTPTypeDevicePropDesc::ECurrentValue, *iData);
 	
@@ -443,10 +445,12 @@
     iPropDesc = CMTPTypeDevicePropDesc::NewL(EMTPDevicePropCodeModelID, 0, 0, NULL);   
     
     delete iData;
+    iData = NULL;
     iData = GetGUIDL(MMTPFrameworkConfig::EDeviceDefaultModelID);  
     iPropDesc->SetL(CMTPTypeDevicePropDesc::EFactoryDefaultValue, *iData);
     
     delete iData;
+    iData = NULL;
     iData = GetGUIDL(MMTPFrameworkConfig::EDeviceCurrentModelID); 
 	iPropDesc->SetL(CMTPTypeDevicePropDesc::ECurrentValue, *iData);
 	
--- a/mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetdevicepropvalue.cpp	Fri Sep 17 11:40:03 2010 +0800
+++ b/mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetdevicepropvalue.cpp	Tue Sep 28 20:14:08 2010 +0800
@@ -223,6 +223,7 @@
      OstTraceFunctionEntry0( CMTPGETDEVICEPROPVALUE_SERVICEFUNCTIONALIDL_ENTRY );
 
     delete iData;
+    iData = NULL;
     iData = GetGUIDL(MMTPFrameworkConfig::EDeviceCurrentFuncationalID); 
     
      SendDataL(*iData); 
@@ -237,6 +238,7 @@
      OstTraceFunctionEntry0( CMTPGETDEVICEPROPVALUE_SERVICEMODELIDL_ENTRY );
      
      delete iData;
+     iData = NULL;
      iData = GetGUIDL(MMTPFrameworkConfig::EDeviceCurrentModelID); 
  	
      SendDataL(*iData); 
--- a/mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetobjecthandles.cpp	Fri Sep 17 11:40:03 2010 +0800
+++ b/mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetobjecthandles.cpp	Tue Sep 28 20:14:08 2010 +0800
@@ -114,6 +114,7 @@
     iTimeoutCount = 0;
     
 	delete iHandles;
+	iHandles = NULL;
 	iHandles = CMTPTypeArray::NewL(EMTPTypeAUINT32);
 
 	OstTraceExt2( TRACE_NORMAL, DUP2_CMTPGETOBJECTHANDLES_SERVICEL, 
--- a/mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetserviceinfo.cpp	Fri Sep 17 11:40:03 2010 +0800
+++ b/mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetserviceinfo.cpp	Tue Sep 28 20:14:08 2010 +0800
@@ -128,6 +128,7 @@
     OstTraceFunctionEntry0( CMTPGETSERVICEINFO_BUILDSERVICEINFOL_ENTRY );
     
     delete iServiceInfo;
+    iServiceInfo = NULL;
     iServiceInfo = CMTPTypeServiceInfo::NewL();
     
     TUint32 serviceId = Request().Uint32(TMTPTypeRequest::ERequestParameter1);
--- a/mtpfws/mtpfw/dataproviders/devdp/src/cmtpresetdevicepropvalue.cpp	Fri Sep 17 11:40:03 2010 +0800
+++ b/mtpfws/mtpfw/dataproviders/devdp/src/cmtpresetdevicepropvalue.cpp	Tue Sep 28 20:14:08 2010 +0800
@@ -239,6 +239,7 @@
     {	 
     OstTraceFunctionEntry0( CMTPRESETDEVICEPROPVALUE_SERVICEFUNCTIONALIDL_ENTRY );
     delete iData;
+    iData = NULL;
     iData = GetGUIDL( MMTPFrameworkConfig::EDeviceDefaultFuncationalID ); 
     SaveGUID(MMTPFrameworkConfig::EDeviceCurrentFuncationalID, *iData);
     SendResponseL(EMTPRespCodeOK);
--- a/mtpfws/mtpfw/dataproviders/dputility/src/cmtpgetformatcapabilities.cpp	Fri Sep 17 11:40:03 2010 +0800
+++ b/mtpfws/mtpfw/dataproviders/dputility/src/cmtpgetformatcapabilities.cpp	Tue Sep 28 20:14:08 2010 +0800
@@ -48,6 +48,7 @@
 void CMTPGetFormatCapabilities::ServiceL()
     {
     delete iCapabilityList;
+    iCapabilityList = NULL;
     iCapabilityList = CMTPTypeFormatCapabilityList::NewL();
     iFormatCode = Request().Uint32(TMTPTypeRequest::ERequestParameter1);
 
--- a/mtpfws/mtpfw/dataproviders/dputility/src/cmtpgetobjectproplist.cpp	Fri Sep 17 11:40:03 2010 +0800
+++ b/mtpfws/mtpfw/dataproviders/dputility/src/cmtpgetobjectproplist.cpp	Tue Sep 28 20:14:08 2010 +0800
@@ -278,6 +278,7 @@
 	CleanupClosePushL(handles);
 	
 	delete iHandles;
+	iHandles = NULL;
 	iHandles = CMTPTypeArray::NewL(EMTPTypeAUINT32);
 	
 	do
--- a/mtpfws/mtpfw/dataproviders/dputility/src/cmtpgetpartialobject.cpp	Fri Sep 17 11:40:03 2010 +0800
+++ b/mtpfws/mtpfw/dataproviders/dputility/src/cmtpgetpartialobject.cpp	Tue Sep 28 20:14:08 2010 +0800
@@ -139,6 +139,7 @@
     else
         {
         delete iFileObject;
+        iFileObject = NULL;
         iFileObject = CMTPTypeFile::NewL(iFramework.Fs(), iObjectInfo->DesC(CMTPObjectMetaData::ESuid), EFileRead, iLength, iOffset);
     	SendDataL(*iFileObject);
         }
--- a/mtpfws/mtpfw/dataproviders/proxydp/src/cmtpdeleteobjectproplist.cpp	Fri Sep 17 11:40:03 2010 +0800
+++ b/mtpfws/mtpfw/dataproviders/proxydp/src/cmtpdeleteobjectproplist.cpp	Tue Sep 28 20:14:08 2010 +0800
@@ -92,6 +92,7 @@
     OstTraceFunctionEntry0( CMTPDELETEOBJECTPROPLIST_SERVICEL_ENTRY );
     
     delete iDeleteObjectPropList;
+    iDeleteObjectPropList = NULL;
     iTargetDps.Reset();
     iSubDatasets.Reset();
     
--- a/mtpfws/mtpfw/dataproviders/proxydp/src/cmtpgetformatcapabilities.cpp	Fri Sep 17 11:40:03 2010 +0800
+++ b/mtpfws/mtpfw/dataproviders/proxydp/src/cmtpgetformatcapabilities.cpp	Tue Sep 28 20:14:08 2010 +0800
@@ -83,6 +83,7 @@
     OstTraceFunctionEntry0( CMTPGETFORMATCAPABILITIES_SERVICEL_ENTRY );
     
     delete iCapabilityList;
+    iCapabilityList = NULL;
     iCapabilityList = CMTPTypeFormatCapabilityList::NewL();
     iTargetDps.Reset();
     
--- a/mtpfws/mtpfw/datatypes/src/cmtptypeserviceobjpropextnform.cpp	Fri Sep 17 11:40:03 2010 +0800
+++ b/mtpfws/mtpfw/datatypes/src/cmtptypeserviceobjpropextnform.cpp	Tue Sep 28 20:14:08 2010 +0800
@@ -190,6 +190,7 @@
             {
         case EFlat1Chunk:     
             delete iChunkName;
+            iChunkName = NULL;
             iChunkName = CMTPTypeString::NewL();
             ChunkAppendL(*iChunkName);
             break;
--- a/mtpfws/mtpfw/src/cmtpconnectionmgr.cpp	Fri Sep 17 11:40:03 2010 +0800
+++ b/mtpfws/mtpfw/src/cmtpconnectionmgr.cpp	Tue Sep 28 20:14:08 2010 +0800
@@ -169,6 +169,7 @@
                 {
                 iTransport->Stop(*this);
                 delete iTransport;
+                iTransport = NULL;
                 iTransportCount--;
                 iTransport = CMTPTransportPlugin::NewL(aTransport, aParameter);
                 
--- a/mtpfws/mtpfw/src/cmtpdeltadatamgr.cpp	Fri Sep 17 11:40:03 2010 +0800
+++ b/mtpfws/mtpfw/src/cmtpdeltadatamgr.cpp	Tue Sep 28 20:14:08 2010 +0800
@@ -104,7 +104,8 @@
 			        OstTrace0( TRACE_ERROR, DUP1_CMTPDELTADATAMGR_CREATEDELTADATATABLEL, "PuidIndex on MTPDeltaDataTable create error!" ));       
 			}
 		}
-	iDeltaTableBatched.Open(iDatabase, KMTPDeltaDataTable, RDbRowSet::EUpdatable);
+	LEAVEIFERROR(iDeltaTableBatched.Open(iDatabase, KMTPDeltaDataTable, RDbRowSet::EUpdatable),
+			        OstTrace0( TRACE_ERROR, DUP1_CMTPDELTADATAMGR_CREATEDELTADATATABLEL, "MTPDeltaDataTable open error!" ));       
 		
 	OstTraceFunctionExit0( CMTPDELTADATAMGR_CREATEDELTADATATABLEL_EXIT );
 	}
@@ -132,7 +133,8 @@
 			        OstTrace0( TRACE_ERROR, DUP1_CMTPDELTADATAMGR_CREATEANCHORIDTABLEL, "INDEX IdentifierIndex on AnchorIdTable create error!" ));
 			}
 		}
-	iAnchorTableBatched.Open(iDatabase, KAnchorIdTable, RDbRowSet::EUpdatable);
+	LEAVEIFERROR(iAnchorTableBatched.Open(iDatabase, KAnchorIdTable, RDbRowSet::EUpdatable),
+		OstTrace0( TRACE_ERROR, DUP1_CMTPDELTADATAMGR_CREATEANCHORIDTABLEL, "AnchorIdTable open error!" ));       
 		
 	OstTraceFunctionExit0( CMTPDELTADATAMGR_CREATEANCHORIDTABLEL_EXIT );
 	}
--- a/mtpfws/mtpfw/src/cmtpframeworkconfig.cpp	Fri Sep 17 11:40:03 2010 +0800
+++ b/mtpfws/mtpfw/src/cmtpframeworkconfig.cpp	Tue Sep 28 20:14:08 2010 +0800
@@ -44,9 +44,14 @@
     {
     //Save the AbnormalDown state to EFalse
     const TInt KNormalShutDownValue = 0;
-    iRepository->Set(EAbnormalDown, KNormalShutDownValue);
     
-    delete iRepository;
+    if( iRepository )
+    	{
+    	iRepository->Set(EAbnormalDown, KNormalShutDownValue);
+    	delete iRepository;
+    	iRepository = NULL;
+  		}
+    
     }
 
 EXPORT_C void CMTPFrameworkConfig::GetValueL(TParameter aParam, TDes& aValue) const
--- a/mtpfws/mtpfw/src/cmtpobjectstore.cpp	Fri Sep 17 11:40:03 2010 +0800
+++ b/mtpfws/mtpfw/src/cmtpobjectstore.cpp	Tue Sep 28 20:14:08 2010 +0800
@@ -237,7 +237,7 @@
 	{
 	RDbTable temp;
 	CleanupClosePushL(temp);
-	temp.Open(iDatabase, KSQLHandleTableName, RDbRowSet::EUpdatable);
+	User::LeaveIfError(temp.Open(iDatabase, KSQLHandleTableName, RDbRowSet::EUpdatable));
 
 	TUint32 tmpStorageID = 0;
 	TBool bStorageAvailable = ETrue;
--- a/mtpfws/mtpfw/src/cmtpreferencemgr.cpp	Fri Sep 17 11:40:03 2010 +0800
+++ b/mtpfws/mtpfw/src/cmtpreferencemgr.cpp	Tue Sep 28 20:14:08 2010 +0800
@@ -176,7 +176,7 @@
 		{
 		CreateIndexL();
 		}
-	iBatched.Open(*iDatabase, KSQLReferenceTableName, RDbRowSet::EUpdatable);
+	User::LeaveIfError(iBatched.Open(*iDatabase, KSQLReferenceTableName, RDbRowSet::EUpdatable));
 	iBatched.SetIndex( KSQLReferenceIndexName ); 
 	}
 
--- a/mtptransports/mtpptpiptransport/filterapi/interface/cptpiphostfilterinterface.h	Fri Sep 17 11:40:03 2010 +0800
+++ b/mtptransports/mtpptpiptransport/filterapi/interface/cptpiphostfilterinterface.h	Tue Sep 28 20:14:08 2010 +0800
@@ -37,7 +37,7 @@
 #include <mtp/mptpiphostfilter.h>
 
 
-class CPTPIPHostFilterInterface : public MPTPIPHostFilter
+class CPTPIPHostFilterInterface : public CBase, public MPTPIPHostFilter
 {	
 	public:
 		IMPORT_C static CPTPIPHostFilterInterface* NewL();				
--- a/mtptransports/mtpptpiptransport/ptpipcontroller/eabi/ptpipcontrolleru.def	Fri Sep 17 11:40:03 2010 +0800
+++ b/mtptransports/mtpptpiptransport/ptpipcontroller/eabi/ptpipcontrolleru.def	Tue Sep 28 20:14:08 2010 +0800
@@ -21,6 +21,10 @@
 	_ZTV11CPTPIPTimer @ 20 NONAME
 	_ZTV16CPTPIPController @ 21 NONAME
 	_ZTV19CPTPIPSocketHandler @ 22 NONAME
-	_ZThn4_N16CPTPIPControllerD0Ev @ 23 NONAME
-	_ZThn4_N16CPTPIPControllerD1Ev @ 24 NONAME
+	_ZThn28_N16CPTPIPController10NewSocketLEv @ 23 NONAME
+	_ZThn28_N16CPTPIPController13SetDeviceGUIDER6TDesC8 @ 24 NONAME
+	_ZThn28_N16CPTPIPController13StopTransportEv @ 25 NONAME
+	_ZThn28_N16CPTPIPController14SocketAcceptedER14TRequestStatus @ 26 NONAME
+	_ZThn28_N16CPTPIPController21SetDeviceFriendlyNameEP7TDesC16 @ 27 NONAME
 
+
--- a/mtptransports/mtpptpiptransport/ptpipcontroller/inc/cptpipcontroller.h	Fri Sep 17 11:40:03 2010 +0800
+++ b/mtptransports/mtpptpiptransport/ptpipcontroller/inc/cptpipcontroller.h	Tue Sep 28 20:14:08 2010 +0800
@@ -73,7 +73,7 @@
 }; 		
 
 
-class CPTPIPController : public MPTPIPController,public CActive
+class CPTPIPController : public CActive, public MPTPIPController
 {
 public:	 
 	IMPORT_C static CPTPIPController* NewL();
--- a/mtptransports/mtpptpiptransport/ptpipcontroller/src/cptpipcontroller.cpp	Fri Sep 17 11:40:03 2010 +0800
+++ b/mtptransports/mtpptpiptransport/ptpipcontroller/src/cptpipcontroller.cpp	Tue Sep 28 20:14:08 2010 +0800
@@ -341,6 +341,7 @@
 	{
 	OstTraceFunctionEntry0( CPTPIPCONTROLLER_SETDEVICEFRIENDLYNAME_ENTRY );
 	delete iDeviceFriendlyName;
+	iDeviceFriendlyName = NULL;
 	
 	TRAPD(err, iDeviceFriendlyName=aDeviceFreindlyName->AllocL());