Midibuffer from audio callback

Hi,

could it be that the Midibuffer, passed by the audio callback could contain invalid data when closing
the plugin or host application? The reason for that question is that my plugin hits a Windows break point here.

The scenario is as follows:

I pass the untouched Midibuffer from the callback to a lock less FIFO to let another thread pick it up from there.
This works fine unless I close the plugin or host.
The strange thing is that this does NOT happen if I pass a different Midibuffer (a member of Audioprocessor) or another
Midibuffer containing Midiclock sync messages to the FIFO. It’s only if I use the host its Midibuffer.
I can imagine that this buffer might be invalid when closing the host but how can I find that out?

Thank you in advance…
Joerg

Some more info`s:

It doesnt happen in Cubase but in Reaper but only if I automate a parameter!
Another hint is that everything works fine if I clear the host Midibuffer before
sending to the FIFO.

Joerg