Crash dismissing modal dialog with animation

Hello all,

I ran into a situation that I can not solve in iOS.

I have a few dialogs whose TextEditors would be covered by the iOS keyboard. So I've created an auxiliary modal dialog that I use to receive text input for a single editor when this is selected by the user.

The dialog is first created offscreen and then shown with an animation. If the user clicks outside of it, it is first brought out of sight with another animation and then dismissed.

The dialog is dismissed calling exitModalState(), in a changeListenerCallback() which is called by the Desktop's ComponentAnimator when it has finished its work.

Unfortunately, often (but not always) a EXC_BAD_ACCESS happens in MessageManager::runDispatchLoopUntil() at the line:

[[NSRunLoop currentRunLoop] runMode: NSDefaultRunLoopMode

If I avoid the animation that hides the dialog and directly call exitModalState(), everything seems to work normally. I guess this is something related to timing.

Do you have any advice? Thank you!

Hello Jules,

any possible advice?

Nothing I can think of without more clues. Just knowing that it crashes somewhere in the message thread tells us nothing at all!

Most likely you're deleting something twice, but impossible to know from what you've said here.

The problem seems limited to iOS, since the same code worked on OSX.

Anyway, it turns out that in iOS, if both modal dialogs and animations are needed, DialogWindows MUST be child components, i.e. created with the addToDesktop parameter set to false.