diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx index 1793afdf524f..09cb50c296be 100644 --- a/vcl/source/window/dialog.cxx +++ b/vcl/source/window/dialog.cxx @@ -867,34 +867,30 @@ short Dialog::Execute() if ( !ImplStartExecuteModal() ) return 0; - ImplDelData aDelData; - ImplAddDel( &aDelData ); + VclPtr xWindow = this; #ifdef DBG_UTIL - ImplDelData aParentDelData; - vcl::Window* pDialogParent = mpDialogParent; - if( pDialogParent ) - pDialogParent->ImplAddDel( &aParentDelData ); + VclPtr xDialogParent = mpDialogParent; #endif // Yield util EndDialog is called or dialog gets destroyed // (the latter should not happen, but better safe than sorry - while ( !aDelData.IsDead() && mbInExecute ) + while ( !xWindow->IsDisposed() && mbInExecute ) Application::Yield(); ImplEndExecuteModal(); #ifdef DBG_UTIL - if( pDialogParent ) + if( xDialogParent ) { - if( ! aParentDelData.IsDead() ) - pDialogParent->ImplRemoveDel( &aParentDelData ); + if( ! xDialogParent->IsDisposed() ) + xDialogParent.clear() else OSL_FAIL( "Dialog::Execute() - Parent of dialog destroyed in Execute()" ); } #endif - if ( !aDelData.IsDead() ) - ImplRemoveDel( &aDelData ); + if ( !xWindow->IsDisposed() ) + xWindow.clear(); #ifdef DBG_UTIL else {