+ // it is common to create a modal dialog in OnInit() (to ask/notify the
+ // user about something) but it wouldn't work if we don't change the
+ // "exit on delete last frame" flag here as when this dialog is
+ // deleted, the app would terminate (it was the last top level window
+ // as the main frame wasn't created yet!), so disable this behaviour
+ // temproarily
+ bool exitOnLastFrameDelete = wxTheApp->GetExitOnFrameDelete();
+ wxTheApp->SetExitOnFrameDelete(FALSE);
+
+ // init the app
+ retValue = wxEntryInitGui() && wxTheApp->OnInit() ? 0 : -1;
+
+ // restore the old flag value
+ wxTheApp->SetExitOnFrameDelete(exitOnLastFrameDelete);
+
+ if ( retValue == 0 )