# Crashes when I use removeParameterListener for an additional AudioProcessorValueTreeState

**URL:** <https://forum.juce.com/t/crashes-when-i-use-removeparameterlistener-for-an-additional-audioprocessorvaluetreestate/59832>\
**Category:** General JUCE discussion\
**Created:** [February 5, 2024, 11:06am UTC](https://forum.juce.com/t/crashes-when-i-use-removeparameterlistener-for-an-additional-audioprocessorvaluetreestate/59832 "2024-02-05T11:06:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Froggo-Lab](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/froggo-lab/32/17809_2.png) [@Froggo-Lab](https://forum.juce.com/u/Froggo-Lab)\
**Post date:** [February 5, 2024, 11:06am UTC](https://forum.juce.com/t/crashes-when-i-use-removeparameterlistener-for-an-additional-audioprocessorvaluetreestate/59832/1 "2024-02-05T11:06:11Z")

</div>

Hello!  
I’m using an additional `AudioProcessorValueTreeState` for private parameters that the host should not see, but when the application is closed, a crash occurs in the destructors of my audio processors, at the moment when `apvtsPrivate.removeParameterListener` is called. All audio processors are within an `AudioProcessorGraph`. I suspect the issue is that `apvtsPrivate` is already deleted when the audio processor destructors are invoked. I’m unsure how to destroy them beforehand. Attempting to call the `clear()` method on `AudioProcessorGraph` or `Node` `AudioProcessorGraph` doesn’t trigger the destructors of audio processors.

Can anyone advise on the optimal usage of an additional AudioProcessorValueTreeState in conjunction with AudioProcessorGraph? Or perhaps suggest a better solution for private parameters?

Thanks in advance for any insights!

 ![Screenshot 2024-02-05 at 15.05.31](https://us1.discourse-cdn.com/flex026/uploads/juce/original/3X/9/3/93e49729ccb53ade08f25bbc46bccf1b5805bc68.jpeg)  
"

---

<div class="post-metadata">

**Author:** ![Froggo-Lab](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/froggo-lab/32/17809_2.png) [@Froggo-Lab](https://forum.juce.com/u/Froggo-Lab)\
**Post date:** [February 5, 2024, 2:34pm UTC](https://forum.juce.com/t/crashes-when-i-use-removeparameterlistener-for-an-additional-audioprocessorvaluetreestate/59832/2 "2024-02-05T14:34:20Z")

</div>

I discovered a problem — I needed to declare APVTS objects in a different order. 😃
