X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6120f2fcdb680c05798202695ed05dcc57449c4b..a83ea9c15a7ac7bbdc6686164cfcbbc21ae5031a:/src/gtk1/filedlg.cpp diff --git a/src/gtk1/filedlg.cpp b/src/gtk1/filedlg.cpp index 6234348501..adb8f61207 100644 --- a/src/gtk1/filedlg.cpp +++ b/src/gtk1/filedlg.cpp @@ -108,10 +108,15 @@ static void gtk_filedialog_response_callback(GtkWidget *w, { 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); + 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,7 +188,8 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message, wxFileDialog::~wxFileDialog() { - m_widget = NULL; + if (m_destroyed_by_delete) + m_widget = NULL; } void wxFileDialog::GetFilenames(wxArrayString& files) const