A view can be deactivated by either switching views or by closing the
application (the view is deleted in both cases). If an application needs to
remove MSK (or any softkey command) from the stack while in view deactivation,
the application must make sure that RemoveCommandFromStack
is
not called when the UI (that is, the whole application) is closed. Here is
an example from the PSLN application:
void CPslnGeneralThemeView::DoDeactivate() { RemoveCommandFromMSK(); CPslnBaseView::DoDeactivate(); } void CPslnGeneralThemeView::RemoveCommandFromMSK() { CEikButtonGroupContainer* cbaGroup = Cba(); // Check if model exists => indicates that UI is not exiting. if ( cbaGroup && iPslnUi->Model() ) { cbaGroup->RemoveCommandFromStack( KPslnMSKControlID, EPslnCmdAppDownload); cbaGroup->RemoveCommandFromStack( KPslnMSKControlID, EpslnCmdAppActivate); } }