unset the dialog as top level window in Destroy(), not in dtor

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7659 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2000-06-30 13:38:08 +00:00
parent c17d222122
commit 0e86e26936
2 changed files with 28 additions and 16 deletions

View File

@@ -316,13 +316,6 @@ wxDialog::~wxDialog()
{
m_isBeingDeleted = TRUE;
wxTopLevelWindows.DeleteObject( this );
if (wxTheApp->GetTopWindow() == this)
{
wxTheApp->SetTopWindow( (wxWindow*) NULL );
}
if ((wxTopLevelWindows.Number() == 0) &&
(wxTheApp->GetExitOnFrameDelete()))
{
@@ -412,7 +405,20 @@ void wxDialog::OnCloseWindow(wxCloseEvent& WXUNUSED(event))
bool wxDialog::Destroy()
{
if (!wxPendingDelete.Member(this)) wxPendingDelete.Append(this);
// schedule the dialog for the deletion
if ( !wxPendingDelete.Member(this) )
{
wxPendingDelete.Append(this);
}
// don't leave a dangling pointer as the app top window, we can be deleted
// any moment at all now!
if ( wxTheApp->GetTopWindow() == this )
{
wxTheApp->SetTopWindow( (wxWindow*) NULL );
}
wxTopLevelWindows.DeleteObject( this );
return TRUE;
}

View File

@@ -316,13 +316,6 @@ wxDialog::~wxDialog()
{
m_isBeingDeleted = TRUE;
wxTopLevelWindows.DeleteObject( this );
if (wxTheApp->GetTopWindow() == this)
{
wxTheApp->SetTopWindow( (wxWindow*) NULL );
}
if ((wxTopLevelWindows.Number() == 0) &&
(wxTheApp->GetExitOnFrameDelete()))
{
@@ -412,7 +405,20 @@ void wxDialog::OnCloseWindow(wxCloseEvent& WXUNUSED(event))
bool wxDialog::Destroy()
{
if (!wxPendingDelete.Member(this)) wxPendingDelete.Append(this);
// schedule the dialog for the deletion
if ( !wxPendingDelete.Member(this) )
{
wxPendingDelete.Append(this);
}
// don't leave a dangling pointer as the app top window, we can be deleted
// any moment at all now!
if ( wxTheApp->GetTopWindow() == this )
{
wxTheApp->SetTopWindow( (wxWindow*) NULL );
}
wxTopLevelWindows.DeleteObject( this );
return TRUE;
}