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:
SDK: 3rd edition maintenance release.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; } }



