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:
@@ -43,9 +43,11 @@ public:
|
|||||||
virtual void SetFilename(const wxString& name);
|
virtual void SetFilename(const wxString& name);
|
||||||
virtual void SetWildcard(const wxString& wildCard);
|
virtual void SetWildcard(const wxString& wildCard);
|
||||||
virtual void SetFilterIndex(int filterIndex);
|
virtual void SetFilterIndex(int filterIndex);
|
||||||
|
|
||||||
|
//private:
|
||||||
|
bool m_destroyed_by_delete;
|
||||||
|
|
||||||
void UpdateFromDialog();
|
void UpdateFromDialog();
|
||||||
private:
|
|
||||||
void UpdateDialog();
|
void UpdateDialog();
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxFileDialog)
|
DECLARE_DYNAMIC_CLASS(wxFileDialog)
|
||||||
|
@@ -43,9 +43,11 @@ public:
|
|||||||
virtual void SetFilename(const wxString& name);
|
virtual void SetFilename(const wxString& name);
|
||||||
virtual void SetWildcard(const wxString& wildCard);
|
virtual void SetWildcard(const wxString& wildCard);
|
||||||
virtual void SetFilterIndex(int filterIndex);
|
virtual void SetFilterIndex(int filterIndex);
|
||||||
|
|
||||||
|
//private:
|
||||||
|
bool m_destroyed_by_delete;
|
||||||
|
|
||||||
void UpdateFromDialog();
|
void UpdateFromDialog();
|
||||||
private:
|
|
||||||
void UpdateDialog();
|
void UpdateDialog();
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxFileDialog)
|
DECLARE_DYNAMIC_CLASS(wxFileDialog)
|
||||||
|
@@ -110,8 +110,13 @@ static void gtk_filedialog_response_callback(GtkWidget *w,
|
|||||||
|
|
||||||
if (response == GTK_RESPONSE_ACCEPT)
|
if (response == GTK_RESPONSE_ACCEPT)
|
||||||
gtk_filedialog_ok_callback(w, dialog);
|
gtk_filedialog_ok_callback(w, dialog);
|
||||||
else
|
else if (response == GTK_RESPONSE_CANCEL)
|
||||||
gtk_filedialog_cancel_callback(w, dialog);
|
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)
|
wildCard, style, pos)
|
||||||
{
|
{
|
||||||
m_needParent = FALSE;
|
m_needParent = FALSE;
|
||||||
|
m_destroyed_by_delete = FALSE;
|
||||||
|
|
||||||
if (!PreCreation(parent, pos, wxDefaultSize) ||
|
if (!PreCreation(parent, pos, wxDefaultSize) ||
|
||||||
!CreateBase(parent, wxID_ANY, pos, wxDefaultSize, style,
|
!CreateBase(parent, wxID_ANY, pos, wxDefaultSize, style,
|
||||||
@@ -182,6 +188,8 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
|
|||||||
|
|
||||||
wxFileDialog::~wxFileDialog()
|
wxFileDialog::~wxFileDialog()
|
||||||
{
|
{
|
||||||
|
if (m_destroyed_by_delete)
|
||||||
|
m_widget = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileDialog::GetFilenames(wxArrayString& files) const
|
void wxFileDialog::GetFilenames(wxArrayString& files) const
|
||||||
|
@@ -110,8 +110,13 @@ static void gtk_filedialog_response_callback(GtkWidget *w,
|
|||||||
|
|
||||||
if (response == GTK_RESPONSE_ACCEPT)
|
if (response == GTK_RESPONSE_ACCEPT)
|
||||||
gtk_filedialog_ok_callback(w, dialog);
|
gtk_filedialog_ok_callback(w, dialog);
|
||||||
else
|
else if (response == GTK_RESPONSE_CANCEL)
|
||||||
gtk_filedialog_cancel_callback(w, dialog);
|
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)
|
wildCard, style, pos)
|
||||||
{
|
{
|
||||||
m_needParent = FALSE;
|
m_needParent = FALSE;
|
||||||
|
m_destroyed_by_delete = FALSE;
|
||||||
|
|
||||||
if (!PreCreation(parent, pos, wxDefaultSize) ||
|
if (!PreCreation(parent, pos, wxDefaultSize) ||
|
||||||
!CreateBase(parent, wxID_ANY, pos, wxDefaultSize, style,
|
!CreateBase(parent, wxID_ANY, pos, wxDefaultSize, style,
|
||||||
@@ -182,6 +188,8 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
|
|||||||
|
|
||||||
wxFileDialog::~wxFileDialog()
|
wxFileDialog::~wxFileDialog()
|
||||||
{
|
{
|
||||||
|
if (m_destroyed_by_delete)
|
||||||
|
m_widget = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileDialog::GetFilenames(wxArrayString& files) const
|
void wxFileDialog::GetFilenames(wxArrayString& files) const
|
||||||
|
Reference in New Issue
Block a user