Destroy modeless wxGenericAboutDialog when it is closed.

Don't leave the wxGenericAboutDialog object alive when non-modal about dialog
(as can be used under GTK and OS X) is closed. This is wasteful and, worse,
resulted in the program not exiting after such a dialog was shown because it
counted as a remaining open top level window.

This also fixes the same bug in wxGTK when using GTK+ 2.4.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70413 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2012-01-20 22:11:32 +00:00
parent 2d143b6689
commit 04ca40fce8
2 changed files with 42 additions and 1 deletions

View File

@@ -220,6 +220,13 @@ bool wxGenericAboutDialog::Create(const wxAboutDialogInfo& info, wxWindow* paren
CentreOnParent();
#if !wxUSE_MODAL_ABOUT_DIALOG
Connect(wxEVT_CLOSE_WINDOW,
wxCloseEventHandler(wxGenericAboutDialog::OnCloseWindow));
Connect(wxID_OK, wxEVT_COMMAND_BUTTON_CLICKED,
wxCommandEventHandler(wxGenericAboutDialog::OnOK));
#endif // !wxUSE_MODAL_ABOUT_DIALOG
return true;
}
@@ -265,13 +272,31 @@ void wxGenericAboutDialog::AddCollapsiblePane(const wxString& title,
m_sizerText->Add(pane, wxSizerFlags(0).Expand().Border(wxBOTTOM));
}
#if !wxUSE_MODAL_ABOUT_DIALOG
void wxGenericAboutDialog::OnCloseWindow(wxCloseEvent& event)
{
Destroy();
event.Skip();
}
void wxGenericAboutDialog::OnOK(wxCommandEvent& WXUNUSED(event))
{
// By default a modeless dialog would be just hidden, destroy this one
// instead.
Destroy();
}
#endif // !wxUSE_MODAL_ABOUT_DIALOG
// ----------------------------------------------------------------------------
// public functions
// ----------------------------------------------------------------------------
void wxGenericAboutBox(const wxAboutDialogInfo& info, wxWindow* parent)
{
#if !defined(__WXGTK__) && !defined(__WXMAC__)
#if wxUSE_MODAL_ABOUT_DIALOG
wxGenericAboutDialog dlg(info, parent);
dlg.ShowModal();
#else