mmappcomponents/collectionhelper/src/mpxcollectionuihelperimp.cpp
changeset 64 92dbd2a406d9
parent 32 edd273b3192a
--- a/mmappcomponents/collectionhelper/src/mpxcollectionuihelperimp.cpp	Fri Sep 17 08:33:08 2010 +0300
+++ b/mmappcomponents/collectionhelper/src/mpxcollectionuihelperimp.cpp	Mon Oct 04 00:50:27 2010 +0300
@@ -84,7 +84,7 @@
     iChunkSize = 0;
     iArrayIndex = 0;
     iRefCount = 1;
-
+    iModeId = aModeId;
     }
 
 
@@ -1049,21 +1049,24 @@
 //
 void CMPXCollectionUiHelperImp::Close()
     {
-
-    ASSERT( iRefCount > 0 );
-    if ( --iRefCount == 0 )
+    if ( iModeId == KMcModeDefault )
         {
-        // last client released
-        CMPXCollectionUiHelperImp* s = reinterpret_cast<CMPXCollectionUiHelperImp*>( Dll::Tls() );
-        if ( s )
+        ASSERT( iRefCount > 0 );
+        if ( --iRefCount == 0 )
             {
-            if ( s == this )
+            // last client released
+            CMPXCollectionUiHelperImp* s = reinterpret_cast<CMPXCollectionUiHelperImp*>( Dll::Tls() );
+            if ( s && s == this )
                 {
                 delete this;
                 Dll::SetTls( NULL );
                 }
             }
         }
+    else
+        {
+        delete this;
+        }
     }
 
 // ---------------------------------------------------------------------------