# Audiounit wrapper and component in modal state

**URL:** <https://forum.juce.com/t/audiounit-wrapper-and-component-in-modal-state/2156>\
**Category:** Audio Plugins\
**Created:** [October 9, 2007, 4:52pm UTC](https://forum.juce.com/t/audiounit-wrapper-and-component-in-modal-state/2156 "2007-10-09T16:52:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![pit](https://avatars.discourse-cdn.com/v4/letter/p/f14d63/32.png) [@pit](https://forum.juce.com/u/pit)\
**Post date:** [October 9, 2007, 4:52pm UTC](https://forum.juce.com/t/audiounit-wrapper-and-component-in-modal-state/2156/1 "2007-10-09T16:52:22Z")

</div>

Hi all,  
I got a crash if i try to close the editor when there’s a component in modal state (eg a dialog window is open).

The wrapper checks for any modal component before calling the editor’s destructor.

How to get rid of these before the deleteUI() is called?

Thanks

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [October 9, 2007, 4:58pm UTC](https://forum.juce.com/t/audiounit-wrapper-and-component-in-modal-state/2156/2 "2007-10-09T16:58:55Z")

</div>

Yeah, this is a bit of a tricky one, because when you’re running a modal box, you’re already running an inner loop inside code belonging to the thing that you need to delete, so it’s quite hairy. Ideally, it just shouldn’t be able to close the window while there’s a dialog box open, but that requires OS-level changes. I’ve been thinking about this lately so might add something soon.

But the safest thing is just to avoid any modal loops - just open your dialog boxes as normal windows and delete them when the editor window is closed.

---

<div class="post-metadata">

**Author:** ![pit](https://avatars.discourse-cdn.com/v4/letter/p/f14d63/32.png) [@pit](https://forum.juce.com/u/pit)\
**Post date:** [October 9, 2007, 6:17pm UTC](https://forum.juce.com/t/audiounit-wrapper-and-component-in-modal-state/2156/3 "2007-10-09T18:17:45Z")

</div>

Yeah, i was thinking it was a tricky one.

Using windows instead sounds like the solution for now.

Thanks Jules

---

<div class="post-metadata">

**Author:** ![pit](https://avatars.discourse-cdn.com/v4/letter/p/f14d63/32.png) [@pit](https://forum.juce.com/u/pit)\
**Post date:** [December 13, 2007, 10:46pm UTC](https://forum.juce.com/t/audiounit-wrapper-and-component-in-modal-state/2156/4 "2007-12-13T22:46:42Z")

</div>

Hi folks,

Nobody else has troubles with that? avoid using modal loops is a solution but it’s not perfect as you cannot really have an a component that blocks the focus on itself. no popup menu… ☹

or is it possible?

Jules, any directions where I could look to change that?

cheers

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [May 12, 2017, 10:05am UTC](https://forum.juce.com/t/audiounit-wrapper-and-component-in-modal-state/2156/5 "2017-05-12T10:05:35Z")

</div>


