if (show && CanDoLayoutAdaptation())
         DoLayoutAdaptation();
 
-    bool ret = wxWindow::Show( show );
+    bool ret = wxDialogBase::Show(show);
 
     if (show)
         InitDialog();
     m_isBeingDeleted = true;
 
     // if the dialog is modal, this will end its event loop
-    Show(false);
+    if ( IsModal() )
+        EndModal(wxID_CANCEL);
 }
 
 bool wxDialog::IsModal() const