- // if it wasn't, delete the dialog ourselves
- if ( !::DestroyWindow(GetHwnd()) )
+ // the dialog might have been already deleted if the user closed it
+ // manually but in this case we should have got a notification about it
+ // and the flag must have been set
+ if ( !m_impl->WasClosedByUser() )