Message Mangler Lockup


#1

I’m having some trouble with a MessageManagerLock. I’m following the instructions in the documentation (const MessageManagerLock wrapUpTasks, near the end of the function, as little code as possible after it).

It works as far as skipping the assertion when calling component methods (Vu and clip LED updates), but causes a crash when I close the window and reopen it, and playback stops during redraw or when using a combo box.

The Lock is in processBlock - is that a nono? It’s after all the for loops and heavy processing, and should just pop off the stack pretty quickly.

What did I do wrong? Besides majoring in music instead of software development!

me.upAllNightCoding(true);


#2

Aagh - no, you should never ever use that during processBlock, because there’s no guarantee how long it’ll need to wait before it gets the lock - it might take seconds if the UI thread is busy, and will regularly take > 100ms, which is long enough to cause a glitch.

Locks are bad news in general during the processBlock, but you should be ok if the lock can only ever be used for a tiny and predictable amount of processing on the non-UI thread, like the example in the plugin demo.


#3