X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ce7fe42e848cc0c9058dae906c3a7bded50681e6..12bb29f5432174ecbd65549bda832d70d34a98ae:/src/gtk/filepicker.cpp diff --git a/src/gtk/filepicker.cpp b/src/gtk/filepicker.cpp index 2d1d3b6f5f..bebcf84931 100644 --- a/src/gtk/filepicker.cpp +++ b/src/gtk/filepicker.cpp @@ -103,6 +103,18 @@ bool wxFileButton::Create( wxWindow *parent, wxWindowID id, wxFileButton::~wxFileButton() { + if ( m_dialog ) + { + // We need to delete the C++ dialog object here but we shouldn't delete + // its widget which is used by our GtkFileChooserButton and will be + // deleted by it when it is itself destroyed in our base class dtor. So + // take the widget ownership away from the dialog to avoid GTK+ errors + // that would happen if GtkFileChooserButton tried to access the + // already destroyed dialog widget. + g_object_unref(m_dialog->m_widget); + m_dialog->m_widget = NULL; + delete m_dialog; + } } void wxFileButton::OnDialogOK(wxCommandEvent& ev) @@ -258,6 +270,7 @@ bool wxDirButton::Create( wxWindow *parent, wxWindowID id, wxDirButton::~wxDirButton() { + delete m_dialog; } void wxDirButton::GTKUpdatePath(const char *gtkpath)