How to destroy ValueTree without triggering property change listeners?

I’m implementing project load/save feature and I noticed that there’s no easy way to “bomb the ValueTree from the orbit”. I.e. I would optimally want to take the root node of the ValueTree and delete the whole thing with all its properties without any of the property change listeners getting information about it. This way it would be super simple to just destroy the tree, destroy all my class instances and load new ValueTree from a file and create new instances of my classes based on the loaded data.

So is there an easy way to destroy the whole tree without triggering the property change feature which might point to already deleted class instances etc?

Sounds like this is the main problem here, and the solution is simply to ensure those objects are removed as listeners to the tree before they’re destroyed!

The whole idea of a listener mechanism is to get callbacks when an object changes. Trying to block those callbacks kind of defeats the purpose of the pattern and would likely cause larger problems elsewhere as other listeners won’t be informed of important events.

That seems to be true. I’ll do that. Thanks!