Audio glitch when menu selected

I've been trying to track this down for weeks and basically no avail. I have an app which reads a stream of data in thread A and puts it into a jitter buffer. The jitter buffer is accessed from the audio callback put into the output stream. The jitter buffer is protected by a critical section. I'm looking at moving to a lock-free version, but currently it's not an issue. Pretty standard stuff.

Now there is quite a lot happening in the jitter buffer because it's very low latency and the app has to compensate for all sorts of problems, but it generally keeps the buffer full enough to put out glitch-free sound with very low frame sizes (64 - 128 samples)

... until I choose a menu item and the jitter buffer suddenly can't keep up and the audio glitches all over the place. Now I don't expect anyone to debug the thousands of code lines involved here, but what I can't work out is what is changing in the app when I click on the menu and get a dropdown? I'm using native OSX menus, but even when I remove my own menu and just have the barebones apple menu, it still happens.

I've tried using the bleeding edge Juce version, searching the documentation,  profiling and even delving into the assembly code, but I can't work out what could be changing when I click on the menu,  to cause the problem.

One strange thing - once the problem starts it doesn't go away,  but if I connect with the profiler everything is fine again.

I'm looking for any sort of clue to help me further with solving this, I currently have no idea what to try next.