Throw when calling GUI code from non-GUI thread?

Is there a way to automatically have an exception thrown when some thread which is not the main GUI / message thread calls a GUI method? Just to catch “naughty behaviour” in my code that is not immediately apparent, in a large code base.

JUCE_ASSERT_MESSAGE_THREAD

2 Likes