]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/filedlg.cpp
Crash fix under VC++
[wxWidgets.git] / src / gtk1 / filedlg.cpp
index 20bc8b05589b8c6752b62376a152ebcdf966f362..adb8f61207321d7791d2a68b1db9999a25af7c53 100644 (file)
@@ -110,8 +110,13 @@ static void gtk_filedialog_response_callback(GtkWidget *w,
     
     if (response == GTK_RESPONSE_ACCEPT)
         gtk_filedialog_ok_callback(w, dialog);
-    else
+    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;
+    m_destroyed_by_delete = FALSE;
 
     if (!PreCreation(parent, pos, wxDefaultSize) ||
         !CreateBase(parent, wxID_ANY, pos, wxDefaultSize, style,
@@ -182,6 +188,8 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
 
 wxFileDialog::~wxFileDialog()
 {
+    if (m_destroyed_by_delete)
+        m_widget = NULL;
 }
 
 void wxFileDialog::GetFilenames(wxArrayString& files) const