Burst in track meter when I load my AU synth

I'm building a simple synth and everything seems to work fine but I get a strange behavior in Logic Pro X.

Here is what I'm doing:

- I load the plugin
- Play a few notes
- I remove the plugin 
- I add it again

And that's what happen:


There are no click/pops in the audio, it's just visual. I tried to put breakpoints and all kind of checks in both processBlock and renderNextBlock but the currentSample is always 0 until I play a note, so I don't understand why that happen. I check every pointer I use (!= nullptr) and tried to reduce all the unecessary things.

It doesn't happen if I load and re-load the plugin WITHOUT playing any note the first time. Alsodoesn't seem to happen if I load it in mono, but sometimes the burst happens on both channels in stereo.

I spent all day trying to track this thing down. Hopefully someone can help.

I tried with JuceDemoPlugin and also an old Juce synth and happen almost everytime. So I guess it's a Logic glitch with Juce. It doesn't happen with any other plugin I have.

When I tested it with the breakpoints, it looked like when you first load the plugin in stereo, the Logic track is still mono and renderNextBlock starts to render on only one channel. After a few samples the oher channel is added and probably that's where something happens in the buffer.