]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/filedlg.cpp
Crash fix under VC++
[wxWidgets.git] / src / gtk1 / filedlg.cpp
index 6234348501f40c3bde166d27efa0f4a03b99b6a8..adb8f61207321d7791d2a68b1db9999a25af7c53 100644 (file)
@@ -108,10 +108,15 @@ static void gtk_filedialog_response_callback(GtkWidget *w,
 {
     wxapp_install_idle_handler();
     
 {
     wxapp_install_idle_handler();
     
-    if (response == GTK_RESPONSE_CANCEL)
-        gtk_filedialog_cancel_callback(w, dialog);
-    else
+    if (response == GTK_RESPONSE_ACCEPT)
         gtk_filedialog_ok_callback(w, dialog);
         gtk_filedialog_ok_callback(w, dialog);
+    else if (response == GTK_RESPONSE_CANCEL)
+        gtk_filedialog_cancel_callback(w, dialog);
+    else // "delete"
+    {
+        gtk_filedialog_cancel_callback(w, dialog);
+        dialog->m_destroyed_by_delete = TRUE;
+    }
 }
 
 //-----------------------------------------------------------------------------
 }
 
 //-----------------------------------------------------------------------------
@@ -129,6 +134,7 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
                        wildCard, style, pos)
 {
     m_needParent = FALSE;
                        wildCard, style, pos)
 {
     m_needParent = FALSE;
+    m_destroyed_by_delete = FALSE;
 
     if (!PreCreation(parent, pos, wxDefaultSize) ||
         !CreateBase(parent, wxID_ANY, pos, wxDefaultSize, style,
 
     if (!PreCreation(parent, pos, wxDefaultSize) ||
         !CreateBase(parent, wxID_ANY, pos, wxDefaultSize, style,
@@ -182,7 +188,8 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
 
 wxFileDialog::~wxFileDialog()
 {
 
 wxFileDialog::~wxFileDialog()
 {
-    m_widget = NULL;
+    if (m_destroyed_by_delete)
+        m_widget = NULL;
 }
 
 void wxFileDialog::GetFilenames(wxArrayString& files) const 
 }
 
 void wxFileDialog::GetFilenames(wxArrayString& files) const