Crashes when setting TreeState

I’m having trouble setting up an AudioProcessorValueTreeState in my plugin. I’m a bit confused about how to use it in general because there’s a lot of conflicting advice online, but in my current setup my APVTS is stored in the processor and handed down to all my components. Components are able to set properties to values. Then, my editor hears these changes and repaints the components/whatever else is necessary.

The problem is it’s already crashing when my editor changes the tree state:processor.apvts.state.setProperty(PluginParameters::FILE_PATH, file, &processor.undoManager);
I’m getting a read-access violation “Exception thrown: read access violation. l. was 0xFF000001E4.” I believe l refers to the listener.

Is this somehow a threading issue? This is happening when files are dropped, so maybe there’s some issue there.

Actually, I just fixed this. I’ll put the answer here in case anyone else runs into the same issue (although I could still use some guidance about general usage of APVTS).

My problem was that I did not disconnect the editor when it was destroyed. So, the tree was trying to call a listener that no longer existed.

1 Like