At some point while rearranging displays using the Display preferences in OS X, the number of displays available is apparently zero. So Desktop::Displays::getDisplayContaining() throws an assertion at the line
const Display* best = &displays.getReference(0);
Thanks - I've added a workaround that should prevent any problems if that happens. Would appreciate you giving it a test if you have a way of making the error happen.
It looks like a race condition. I've got a thing called getBackingLayerScale() that is being called from my renderOpenGL() method. This in turn calls getDisplayContaining(). That happens while findDisplays() is being called on the message thread, after
oldDisplays.swapWith (displays);
and before any new displays are found.
I guess adding a critical section is the most straightforward fix. If you can't reproduce the problem easily I can give it a try.
Well sure, I'm calling it from a drawing thread. There’s nothing to warn me that these methods must be called from the message thread. If that’s the case please jassert (MessageManager::getInstance()->isThisTheMessageThread()) as you do elsewhere and I'll get the idea.