×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Oct 2005
    Posts
    5

    CONE 44 panic when deleting tab group

    Hello,

    I am using a dynamically created tab group for one of my views. The creation is successful and tabs work also. However, I am getting CONE 44 panic when I switch view and delete the dynamically created tab group. The documentation for the panic says "Control being destroyed is still on the control stack", but even if I call AppUi()->RemoveFromStack() on the control I am still getting the panic.

    Anybody have any idea what might be going on?

    Here are the relevant parts of the code:

    Code:
    class CMyView : public CAknView,
        public MAknTabObserver
    {
    ...
        private: // Data
            // Pointer to the default navigation pane control. Not owned!
            CAknNavigationControlContainer* iNaviPane;
    
            /// Created tab group. Owned, remember to delete!
            CAknNavigationDecorator* iDecoratedTabGroup;
    
            /// Pointer to the actual tab group instance.
            /// This is owned by the iDecoratedTabGroup instance.
            CAknTabGroup* iTabGroup;
    }
    
    void CMyView::CreateTabGroupL()
    {
        if ( iDecoratedTabGroup )
        {
            // Already exists, do nothing
            return;
        }
    
        // Fetch pointer to the default navi pane control
        iNaviPane = static_cast< CAknNavigationControlContainer* >(
            StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) );
    
        // Create the tab group.
        // The instance returned by CreateTabGroupL() is owned,
        // so remember to delete it.
        TResourceReader reader;
        EikEnv()->CreateResourceReaderLC( reader, R_MY_TAB_GROUP );
        CAknNavigationDecorator* tabGrp = iNaviPane->CreateTabGroupL(
            reader, this );
        CleanupStack::PopAndDestroy(); // reader
        CleanupStack::PushL( tabGrp );
    
        // Add tab group to the navigation pane
        iNaviPane->PushL( *tabGrp );
        iDecoratedTabGroup = tabGrp;
        CleanupStack::Pop( tabGrp );
    
        // Add the actual tab group control to the control stack,
        // otherwise the user can't change the tab
        CAknTabGroup* iTabGroup = static_cast< CAknTabGroup* >(
            iDecoratedTabGroup->DecoratedControl() );
        iTabGroup->SetMopParent( this );
        TRAPD( error, AppUi()->AddToStackL( *this, iTabGroup ) );
        if ( error != KErrNone )
        {
            // Fcuk! Do cleanup and leave
            iNaviPane->Pop();
            delete iDecoratedTabGroup;
            iDecoratedTabGroup = 0;
            iTabGroup = 0;
            iNaviPane = 0;
            User::Leave( error );
        }
    }
    
    void CMyView::DeleteTabGroup()
    {
        if ( iDecoratedTabGroup )
        {
            AppUi()->RemoveFromStack( iTabGroup );
            iNaviPane->Pop( iDecoratedTabGroup );
    
    	// CONE 44 panic when deleting the instance!
            // Happens even if I call RemoveFromStack() before deletion.
            AppUi()->RemoveFromStack( iDecoratedTabGroup );
            delete iDecoratedTabGroup;
    
            iDecoratedTabGroup = 0;
            iTabGroup = 0;
            iNaviPane = 0;
        }
    }
    SDK: 3rd edition maintenance release.

  2. #2
    Regular Contributor
    Join Date
    Mar 2007
    Posts
    61

    Re: CONE 44 panic when deleting tab group

    iDecoratedTabGroup = tabGrp;
    CleanupStack::Pop( tabGrp );


    Here you have assinged the tebgrp to iDecoratedTabGroup,so these to variables uses same memory.

    so, remove these two variable at one time only.

    here you have remove the memory for tabGrp and the memory is also deleted.

    so check this two lines.....

  3. #3
    Registered User
    Join Date
    Oct 2005
    Posts
    5

    Re: CONE 44 panic when deleting tab group

    You have misunderstood how the cleanup stack works. I am using CleanupStack::Pop(), which doesn't delete anything, it just removes the instance from the cleanup stack. So the problem is not there.


    However, I did find the problem (stupid mistake I made ;-). I accidentally created a local variable called iTabGroup, when adding the tab group to the control stack. This meant that the real instance variable iTabGroup remained NULL which was not what I wanted.

    So the fixed code line is this:

    Code:
        iTabGroup = static_cast< CAknTabGroup* >(
            iDecoratedTabGroup->DecoratedControl() );
    Now the control will be properly removed in the DeleteTabGroup() method:

    Code:
    void CBrigstonSettingsView::DeleteTabGroup()
    {
        if ( iDecoratedTabGroup )
        {
            AppUi()->RemoveFromStack( iTabGroup );
            iNaviPane->Pop( iDecoratedTabGroup );
            delete iDecoratedTabGroup;
            iDecoratedTabGroup = 0;
            iTabGroup = 0;
            iNaviPane = 0;
        }
    }

Similar Threads

  1. Using Bluetooth serial port in MIDlets (nokia 9500 issue)
    By orsteglasy in forum Mobile Java Networking & Messaging & Security
    Replies: 11
    Last Post: 2007-10-07, 21:49
  2. why SetMopParent causes CONE 8 PANIC
    By olivier_randria in forum Symbian
    Replies: 4
    Last Post: 2006-12-05, 07:27
  3. Panic Cone 8
    By anupamah in forum Symbian User Interface
    Replies: 0
    Last Post: 2005-07-29, 12:19
  4. CONE 14 Panic
    By edmundkkchan in forum Symbian Tools & SDKs
    Replies: 1
    Last Post: 2003-08-26, 17:55
  5. cone panic codes
    By liammurray in forum Symbian
    Replies: 2
    Last Post: 2002-05-20, 06:01

Posting Permissions

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