ProgressBar and Threads and ValueTrees and Callbacks

So, I don’t think there’s a nice answer to this, but all ideas would be welcome.

We have an import job, that reads a file and updates a ValueTree via some wrapper objects. Works super-great. The ValueTree has some listeners attached that do important jobs.

However the import takes a while. So we put a ProgressBar on it.

So now the import job updates the various application data structures, but we have callbacks hitting on the main thread and stuff bombing out.

So if I can I’m going to rewrite the import job so it does it on a second ValueTree and then we attach it to the other one later on the main thread.

But it’s a hell of a lot of fuss for a progress bar ;-0

It’d be really nice to be able to freeze ValueTree listeners for an operation and then fire them off later… ?

Any other ideas? Thread-safe ValueTree?

Do you rely on intermediary import data, or would it be an option to import to an extra ValueTree and copy the result via ValueTreeSynchroniser::applyChanges() after the import has finished?