Don't validate and transfer data from hidden dialogs when closing.

This is unexpected and resulted e.g. in calling the user-defined
TransferDataFromWindow() multiple times for wxPreferencesPages used in
wxPreferencesEditor under wxGTK (where it is modeless).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78467 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2015-02-10 23:14:35 +00:00
parent a2207b3c94
commit 8ccb2e5525

View File

@ -561,7 +561,13 @@ void wxDialogBase::OnCloseWindow(wxCloseEvent& WXUNUSED(event))
closing.Append(this);
if ( !SendCloseButtonClickEvent() )
// When a previously hidden (necessarily modeless) dialog is being closed,
// we must not perform the usual validation and data transfer steps as they
// had been already done when it was hidden and doing it again now would be
// unexpected and could result in e.g. the dialog asking for confirmation
// before discarding the changes being shown again, which doesn't make
// sense as the dialog is not being closed in response to any user action.
if ( !IsShown() || !SendCloseButtonClickEvent() )
{
// If the handler didn't close the dialog (e.g. because there is no
// button with matching id) we still want to close it when the user