×

Discussion Board

Results 1 to 11 of 11
  1. #1
    Registered User
    Join Date
    Apr 2012
    Posts
    39

    Red face Please help, RPointerArray::ResetAndDestroy() will cause application exit

    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.

    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;
    	}
    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.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;
    	}
    What is the problem?

    It seems that the CSIPProfile pointer within the RPointerArray cannot be destroy ???

    Please help!!

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,167

    Re: Please help, RPointerArray::ResetAndDestroy() will cause application exit

    you could always get some information on the problem by checking the panic code: http://www.developer.nokia.com/Commu...ded_panic_code

    Also you could maybe check if any of your codes between there are causing any problems. Basically comment the whole for loop away, run the code and see whetehr it is still crashing, if it is not, then add it back and comment parts inside it away untill you figure what is causing the problem

  3. #3
    Registered User
    Join Date
    Jan 2005
    Location
    Italy
    Posts
    639

    Re: Please help, RPointerArray::ResetAndDestroy() will cause application exit

    Quote Originally Posted by fnnokia View Post

    It seems that the CSIPProfile pointer within the RPointerArray cannot be destroy ???

    Please help!!
    It could be so... please take a look at RPointerArray usage:
    http://library.developer.nokia.com/i...ass.guide.html
    in particular
    Another issue to remember is the ownership of objects whose pointers are contained within an RPointerArray<class T> array. If ownership of the objects lies elsewhere, then calling Close() or Reset() before the array goes out of scope is sufficient. If, however, ownership of these objects is vested in the array, and it is the intention that these objects be destroyed when the array is destroyed, then ResetAndDestroy() must be called before the array goes out of scope.
    since profiles is filled with data from iProfileRegistry, it could be that ownership isn't transferred.... ?
    regards
    pg

  4. #4
    Registered User
    Join Date
    Apr 2012
    Posts
    39

    Re: Please help, RPointerArray::ResetAndDestroy() will cause application exit

    Quote Originally Posted by pavarang View Post
    It could be so... please take a look at RPointerArray usage:
    http://library.developer.nokia.com/i...ass.guide.html
    in particular

    since profiles is filled with data from iProfileRegistry, it could be that ownership isn't transferred.... ?
    regards
    pg
    1. How can I debug the program in my Nokia Phone??

    2. How to trace the application exit reason ??

    3. I cannot use Emulator to debug, because when I open Emulator,
    ("C:\S60\devices\S60_3rd_FP2_SDK_v1.1\epoc32\release\winscw\udeb\epoc.exe")
    It can show the Emulator interface with white screen for a few seconds, but automatically closed before entering the Symbian OS interface.

    4. Now I test this application by transferring the "sis" file to my Nokia Phone.

  5. #5
    Registered User
    Join Date
    Apr 2012
    Posts
    39

    Talking Re: Please help, RPointerArray::ResetAndDestroy() will cause application exit

    Quote Originally Posted by pavarang View Post
    It could be so... please take a look at RPointerArray usage:
    http://library.developer.nokia.com/i...ass.guide.html
    in particular

    since profiles is filled with data from iProfileRegistry, it could be that ownership isn't transferred.... ?
    regards
    pg
    I think I have found the root cause, but I am not certain about it.

    Code:
    	// Create CAknPopupList instance, popupList
    	CAknPopupList* popupList = CAknPopupList::NewL(list,
    			R_AVKON_SOFTKEYS_SELECT_CANCEL, AknPopupLayouts::EMenuWindow);
    	// Push popupList'pointer to CleanupStack.
    	CleanupStack::PushL(popupList);
    
            ......
    
    	// Show popup list and then show return value.
    	TInt popupOk = popupList->ExecuteLD();
    
    	// Pop the popupList's pointer from CleanupStack
    	CleanupStack::Pop();
    
            //The root cause is here, why we don't need to destroy the popupList's pointer
    
             ...
             ...
    In the above code, we can find that there is no any "delete popupList" or "PopAndDestroy()".

    I think the CSIPProfile's pointer is similar to the CAknPopupList's pointer, both pointers just need to Push() and Pop(), no need to Push() and PopAndDestroy(),

    Is it the right answer ????

  6. #6
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,167

    Re: Please help, RPointerArray::ResetAndDestroy() will cause application exit

    please do answer questions othervise you are making it impossible to help you. Also please try what has been suggested for excatly same reason.

    also you should indeed give valid and accurate information, as far as I can see the popuplist is not related to pointerarray problem, so please do check what is actually happening in there. i.e. which line is giving you the panic, and check the #2 post for the link on checking the panic.

    Anyway, if you managed to fix the pointeraaray problem, then you should know that ExecuteLD LD part means that it is indeed destroyed after usage, so please do inset the pop before the ExecuteLD line.

  7. #7
    Registered User
    Join Date
    Apr 2012
    Posts
    39

    Re: Please help, RPointerArray::ResetAndDestroy() will cause application exit

    Quote Originally Posted by symbianyucca View Post
    please do answer questions othervise you are making it impossible to help you. Also please try what has been suggested for excatly same reason.

    also you should indeed give valid and accurate information, as far as I can see the popuplist is not related to pointerarray problem, so please do check what is actually happening in there. i.e. which line is giving you the panic, and check the #2 post for the link on checking the panic.

    Anyway, if you managed to fix the pointeraaray problem, then you should know that ExecuteLD LD part means that it is indeed destroyed after usage, so please do inset the pop before the ExecuteLD line.
    Thanks, But I cannot get the "panic code", because I am not using the "Emulator"(WINSCW), can you help me to solve my Emulator problem ?
    Please see the #4 for my "Emulator" problem.

  8. #8
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,167

    Re: Please help, RPointerArray::ResetAndDestroy() will cause application exit

    you could simply pack the sis file, and sent it to device which ever ways you would have available. i.e. you could use Bluetooth, or if you have Nokia Suite installed, you could use it also with USB.

  9. #9
    Registered User
    Join Date
    Apr 2012
    Posts
    39

    Re: Please help, RPointerArray::ResetAndDestroy() will cause application exit

    Quote Originally Posted by symbianyucca View Post
    you could simply pack the sis file, and sent it to device which ever ways you would have available. i.e. you could use Bluetooth, or if you have Nokia Suite installed, you could use it also with USB.
    I have already transferred the sis to my device via bluetooth,

    But I don't know how to get the "panic code" works in my phone,

    When application exit, it just close, no any "panic code" popup to tell what problem has happened.

    So, this is what I have said "I don't know how to debug in the phone".

  10. #10
    Registered User
    Join Date
    Jan 2005
    Location
    Italy
    Posts
    639

    Re: Please help, RPointerArray::ResetAndDestroy() will cause application exit

    Quote Originally Posted by fnnokia View Post
    I have already transferred the sis to my device via bluetooth,

    But I don't know how to get the "panic code" works in my phone,
    Y-Tasks, Crash monitor feature:
    http://www.drjukka.com/YTasks.html


    Quote Originally Posted by fnnokia View Post
    So, this is what I have said "I don't know how to debug in the phone".
    It's usually called "On Device Debugging", or ODD, if you want to search more info :-)
    On older devices, TRK:
    http://www.developer.nokia.com/Commu...ng_screencasts
    On newer device, CODA:
    http://www.developer.nokia.com/Commu...for_Symbian_OS

    regards,
    pg

  11. #11
    Registered User
    Join Date
    Nov 2008
    Posts
    7

    Re: Please help, RPointerArray::ResetAndDestroy() will cause application exit

    You need to create a file c:\resource\ErrRD
    Then the phone will display Panic codes

Similar Threads

  1. Replies: 3
    Last Post: 2010-02-05, 10:04
  2. Application exit!
    By ale152 in forum Symbian
    Replies: 2
    Last Post: 2009-08-18, 18:57
  3. Replies: 7
    Last Post: 2009-08-11, 08:21
  4. RPointerArray:: ResetAndDestroy()
    By sandy_zeng in forum Symbian
    Replies: 16
    Last Post: 2008-05-12, 09:06

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×