X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ce7fe42e848cc0c9058dae906c3a7bded50681e6..7169360153f35fe579c7e72fd95a1dbbb2eff043:/src/gtk/filepicker.cpp diff --git a/src/gtk/filepicker.cpp b/src/gtk/filepicker.cpp index 2d1d3b6f5f..3f99ce13f7 100644 --- a/src/gtk/filepicker.cpp +++ b/src/gtk/filepicker.cpp @@ -4,7 +4,6 @@ // Author: Francesco Montorsi // Modified By: // Created: 15/04/2006 -// Id: $Id$ // Copyright: (c) Francesco Montorsi // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -103,6 +102,17 @@ bool wxFileButton::Create( wxWindow *parent, wxWindowID id, wxFileButton::~wxFileButton() { + if ( m_dialog ) + { + // when m_dialog is deleted, it will destroy the widget it is sharing + // with GtkFileChooserButton, which results in a bunch of Gtk-CRITICAL + // errors from GtkFileChooserButton. To avoid this, call gtk_widget_destroy() + // on GtkFileChooserButton first (our base dtor will do it again, but + // that does no harm). m_dialog holds a reference to the shared widget, + // so it won't go away until m_dialog base dtor unrefs it. + gtk_widget_destroy(m_widget); + delete m_dialog; + } } void wxFileButton::OnDialogOK(wxCommandEvent& ev) @@ -258,6 +268,12 @@ bool wxDirButton::Create( wxWindow *parent, wxWindowID id, wxDirButton::~wxDirButton() { + if (m_dialog) + { + // see ~wxFileButton() comment + gtk_widget_destroy(m_widget); + delete m_dialog; + } } void wxDirButton::GTKUpdatePath(const char *gtkpath)