Hi,
When using profiles.Close(); the program can popup a list and show all existed CSIPProfiles.
But when using profiles.ResetAndDestroy(); , the program just close and the whole application is exit.
Below code using the profiles.Close(), works normally.
Below code using the profiles.ResetAndDestroy();, it causes the whole application exit.Code:/** * Handle the selected event. * @param aCommand the command id invoked * @return ETrue if the command was handled, EFalse if not */ TBool CTestAppContainerView::HandleTestMenuItemSelectedL(TInt aCommand) { // Create CEikTextListBox instance, list CEikTextListBox* list = new (ELeave) CAknSinglePopupMenuStyleListBox; // Push list'pointer to CleanupStack. CleanupStack::PushL(list); // Create CAknPopupList instance, popupList CAknPopupList* popupList = CAknPopupList::NewL(list, R_AVKON_SOFTKEYS_SELECT_CANCEL, AknPopupLayouts::EMenuWindow); // Push popupList'pointer to CleanupStack. CleanupStack::PushL(popupList); popupList->SetTitleL(_L("SIP Profiles")); // Initialize listbox. list->ConstructL(popupList, CEikListBox::ELeftDownInViewRect); list->CreateScrollBarFrameL(ETrue); list->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EAuto, CEikScrollBarFrame::EAuto); MDesCArray* textArray = list->Model()->ItemTextArray(); CDesCArray* itemList = static_cast<CDesCArray*> (textArray); // Set listitems. list->Model()->SetOwnershipType(ELbmOwnsItemArray); RPointerArray<CSIPProfile> profiles; iProfileRegistry->ProfilesL(profiles); TInt count = profiles.Count(); for (TInt i = 0; i < count; i++) { CSIPProfile* sipProfile = (CSIPProfile*) profiles[i]; const TDesC8* p8 = NULL; sipProfile->GetParameter(KSIPProviderName, p8); TDesC16* p16 = CTestAppCommon::ConvertTDesC8ToTDesC16(*p8); itemList->AppendL(*p16); delete p8; p8 = NULL; delete p16; p16 = NULL; list->HandleItemAdditionL(); } profiles.Close(); // Show popup list and then show return value. TInt popupOk = popupList->ExecuteLD(); // Pop the popupList's pointer from CleanupStack CleanupStack::Pop(); // Pop and Destroy the list's pointer from CleanupStack CleanupStack::Pop(); delete list; list = NULL; return ETrue; }
What is the problem?Code:/** * Handle the selected event. * @param aCommand the command id invoked * @return ETrue if the command was handled, EFalse if not */ TBool CTestAppContainerView::HandleTestMenuItemSelectedL(TInt aCommand) { // Create CEikTextListBox instance, list CEikTextListBox* list = new (ELeave) CAknSinglePopupMenuStyleListBox; // Push list'pointer to CleanupStack. CleanupStack::PushL(list); // Create CAknPopupList instance, popupList CAknPopupList* popupList = CAknPopupList::NewL(list, R_AVKON_SOFTKEYS_SELECT_CANCEL, AknPopupLayouts::EMenuWindow); // Push popupList'pointer to CleanupStack. CleanupStack::PushL(popupList); popupList->SetTitleL(_L("SIP Profiles")); // Initialize listbox. list->ConstructL(popupList, CEikListBox::ELeftDownInViewRect); list->CreateScrollBarFrameL(ETrue); list->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EAuto, CEikScrollBarFrame::EAuto); MDesCArray* textArray = list->Model()->ItemTextArray(); CDesCArray* itemList = static_cast<CDesCArray*> (textArray); // Set listitems. list->Model()->SetOwnershipType(ELbmOwnsItemArray); RPointerArray<CSIPProfile> profiles; iProfileRegistry->ProfilesL(profiles); TInt count = profiles.Count(); for (TInt i = 0; i < count; i++) { CSIPProfile* sipProfile = (CSIPProfile*) profiles[i]; const TDesC8* p8 = NULL; sipProfile->GetParameter(KSIPProviderName, p8); TDesC16* p16 = CTestAppCommon::ConvertTDesC8ToTDesC16(*p8); itemList->AppendL(*p16); delete p8; p8 = NULL; delete p16; p16 = NULL; list->HandleItemAdditionL(); } profiles.ResetAndDestroy(); // Show popup list and then show return value. TInt popupOk = popupList->ExecuteLD(); // Pop the popupList's pointer from CleanupStack CleanupStack::Pop(); // Pop and Destroy the list's pointer from CleanupStack CleanupStack::Pop(); delete list; list = NULL; return ETrue; }
It seems that the CSIPProfile pointer within the RPointerArray cannot be destroy ???
Please help!!




