]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/dialog.cpp
warning msgs
[wxWidgets.git] / src / gtk1 / dialog.cpp
index 1756334f0c46e9ebb092ca24e1016c9b7540c3e9..f472f31e6c3e6a66976492b7f2d8f6c451263a8f 100644 (file)
 #include "wx/app.h"
 #include "wx/gtk/win_gtk.h"
 
+//-----------------------------------------------------------------------------
+
+extern wxList wxPendingDelete;
+
 //-----------------------------------------------------------------------------
 // delete
 
@@ -120,7 +124,9 @@ void wxDialog::OnApply( wxCommandEvent &WXUNUSED(event) )
 void wxDialog::OnCancel( wxCommandEvent &WXUNUSED(event) )
 {
   if (IsModal())
+  {
     EndModal(wxID_CANCEL);
+  }
   else
   {
     SetReturnCode(wxID_CANCEL);
@@ -133,14 +139,15 @@ void wxDialog::OnOk( wxCommandEvent &WXUNUSED(event) )
   if ( Validate() && TransferDataFromWindow())
   {
     if (IsModal()) 
+    {
       EndModal(wxID_OK);
+    }
     else
     {
       SetReturnCode(wxID_OK);
       this->Show(FALSE);
     };
   };
-  EndModal( wxID_OK );
 };
 
 void wxDialog::OnPaint( wxPaintEvent& WXUNUSED(event) )
@@ -153,7 +160,7 @@ bool wxDialog::OnClose(void)
   static wxList closing;
 
   if (closing.Member(this)) return FALSE;   // no loops
-
+  
   closing.Append(this);
 
   wxCommandEvent cancelEvent(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL);
@@ -164,6 +171,14 @@ bool wxDialog::OnClose(void)
   return FALSE;
 }
 
+bool wxDialog::Destroy(void)
+{
+  if (!wxPendingDelete.Member(this))
+    wxPendingDelete.Append(this);
+
+  return TRUE;
+}
+
 void wxDialog::OnCloseWindow(wxCloseEvent& event)
 {
   if (GetEventHandler()->OnClose() || event.GetForce())
@@ -201,8 +216,8 @@ int wxDialog::ShowModal(void)
 
 void wxDialog::EndModal( int retCode )
 {
-  gtk_main_quit();
   SetReturnCode( retCode );
+  gtk_main_quit();
 };
 
 void wxDialog::InitDialog(void)