# How to delete active dialogs on applicationWillTerminate?

**URL:** <https://forum.juce.com/t/how-to-delete-active-dialogs-on-applicationwillterminate/45369>\
**Category:** MacOSX and iOS\
**Created:** [April 5, 2021, 5:49pm UTC](https://forum.juce.com/t/how-to-delete-active-dialogs-on-applicationwillterminate/45369 "2021-04-05T17:49:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![DaveAE](https://avatars.discourse-cdn.com/v4/letter/d/b77776/32.png) [@DaveAE](https://forum.juce.com/u/DaveAE)\
**Post date:** [April 5, 2021, 5:49pm UTC](https://forum.juce.com/t/how-to-delete-active-dialogs-on-applicationwillterminate/45369/1 "2021-04-05T17:49:29Z")

</div>

When a DialogWindow is present on screen and the user swipes the app up to close it, I’m getting an assert in juce\_Desktop because a dialog is still active. I’m trying to close things in applicationWillTerminate, but can’t seem to find a way. DialogWindow doesn’t have a reference anywhere in my app, it’s just launched with .launchAsync(). If I do try to keep a reference and call exitModalState(0) on it in applicationWillTerminate(), the same assert just happens, probably because it’s an async call. This is on iOS14. Any suggestions?
