--- a/messagingappbase/msgavkon/muiu_internal/settingsarray/src/MuiuSettingsArray.cpp Tue Sep 14 21:11:56 2010 +0300
+++ b/messagingappbase/msgavkon/muiu_internal/settingsarray/src/MuiuSettingsArray.cpp Wed Sep 15 12:08:45 2010 +0300
@@ -111,9 +111,9 @@
item.iLabelText.Copy( *txt );
TBool flag = EFalse;
//If string retrived from resource is "Message sent as"
+ CleanupStack::PushL( txt );
flag = IsMessageSentStringL( txt );
-
- delete txt;
+ CleanupStack::PopAndDestroy( txt );
const TMuiuSettingsType type = ( TMuiuSettingsType ) reader.ReadInt16();
item.iType = type;
@@ -127,25 +127,24 @@
if ( type == EMuiuSettingsSelectionList && array_id )
{
- CDesCArrayFlat* array =
- new( ELeave ) CDesCArrayFlat( KMuiuSettingsArrayGranularity );
- CleanupStack::PushL( array );
- TResourceReader reader2;
- env->CreateResourceReaderLC( reader2, array_id );
+ TResourceReader arrayReader;
+ env->CreateResourceReaderLC( arrayReader, array_id );
- const TInt count = reader2.ReadInt16();
- for ( TInt loop = 0; loop < count; loop++ )
+ CDesCArrayFlat* array = arrayReader.ReadDesCArrayL();
+
+ if ( !flag && array )
{
- HBufC* txt = reader2.ReadHBufCL();
- CleanupStack::PushL( txt );
- array->AppendL( *txt );
- CleanupStack::PopAndDestroy(); // txt
+ item.iMuiuSettingsItemArray = array;
+ CleanupStack::PushL( array );
+ AppendL( item );
+ CleanupStack::Pop( array );
}
- CleanupStack::PopAndDestroy(); //reader2
- item.iMuiuSettingsItemArray = array;
- if(!flag)
- AppendL( item );
- CleanupStack::Pop( array ); //array
+ else
+ {
+ delete array;
+ }
+
+ CleanupStack::PopAndDestroy();
}
else
{