Changing orientation of modal window in iOS causing assertion

iOS8. My iPad app rotates it's orientation just fine, except when there's a modal window present. If I try to change oriention a JUCE assertion is called in line 297:

static void sendScreenBoundsUpdate (JuceUIViewController* c)
    JuceUIView* juceView = (JuceUIView*) [c view];
==> jassert (juceView != nil && juceView->owner != nullptr);

The juceView->owner is NULL, but I can't seem to figure out why, probably due to the fact that I don't completely understand exactly what's going on. Here's my modal window constructor:

MyWindow::MyWindow ()
: DialogWindow ("",
    about = new AboutComponent();
    setContentOwned (about, false);
    setAlwaysOnTop(true); // fixes iOS-only bug in which some of the buttons on this window aren't clickable
    centreWithSize (600, 300);
    setResizable (false, true);
    enterModalState(true, nullptr, false);


Running modal loops on mobile platforms (or any platform TBH) is a really bad idea! And you should definitely avoid it in a constructor. You should try setting your component to be modal and allowing the normal message loop to run, as the order in which things get done here could be screwing things up.

Thanks for the suggestion. I set it up this way on the desktop version first, so I'm kind of stuck with the modality for the mobile version, unless I do a serious rewrite of quite a bit of code (which it looks like I may need to do eventually anyway.)

So if I follow correctly, I should set the owned Component as modal instead of the window? I tried changing

enterModalState(true, nullptr, false);



But I get the same assertion.

No - you should never call runModalLoop(). Bear in mind that on Android, it's impossible to call it, so you may want to refactor things now if you ever intend using that platform.

Good to know! Thanks. Guess it's time for a rewrite.