diff -r c76ea6caa649 -r b276843a15ba mmappcomponents/collectionhelper/src/mpxcollectionuihelperimp.cpp --- a/mmappcomponents/collectionhelper/src/mpxcollectionuihelperimp.cpp Fri Sep 03 20:07:59 2010 -0500 +++ b/mmappcomponents/collectionhelper/src/mpxcollectionuihelperimp.cpp Tue Sep 21 11:25:55 2010 -0500 @@ -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( Dll::Tls() ); - if ( s ) + ASSERT( iRefCount > 0 ); + if ( --iRefCount == 0 ) { - if ( s == this ) + // last client released + CMPXCollectionUiHelperImp* s = reinterpret_cast( Dll::Tls() ); + if ( s && s == this ) { delete this; Dll::SetTls( NULL ); } } } + else + { + delete this; + } } // ---------------------------------------------------------------------------