Dirty hack to prevent double destruction of file dialog.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30812 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
5bef7b5828
commit
c2740a5aab
@ -44,8 +44,10 @@ public:
|
||||
virtual void SetWildcard(const wxString& wildCard);
|
||||
virtual void SetFilterIndex(int filterIndex);
|
||||
|
||||
//private:
|
||||
bool m_destroyed_by_delete;
|
||||
|
||||
void UpdateFromDialog();
|
||||
private:
|
||||
void UpdateDialog();
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxFileDialog)
|
||||
|
@ -44,8 +44,10 @@ public:
|
||||
virtual void SetWildcard(const wxString& wildCard);
|
||||
virtual void SetFilterIndex(int filterIndex);
|
||||
|
||||
//private:
|
||||
bool m_destroyed_by_delete;
|
||||
|
||||
void UpdateFromDialog();
|
||||
private:
|
||||
void UpdateDialog();
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxFileDialog)
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user