Hi,

I'm having a dialog that contains a listbox. Selecting an item in the listbox creates a new dialog in HandleListBoxEventL. In the new dialog user can select Exit from the menu. The new dialog gets an reference to an integer which it uses to inform the first dialog that it requests an exit. However, in HandleListBoxEventL if I try to call TryExitL, the emulator crashes.

void MyDialog::HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType)
{
if (aEventType == EEventEnterKeyPressed)
{
TInt result;
CAnotherDialog::LaunchDialogL(result);
if (result == 1)
{
TryExitL(EAknSoftKeyCancel);
}
}
}

// crashes when leaving HandleListBoxEventL

Is there some other way to do this?