# Unidentified crashing

**URL:** <https://forum.juce.com/t/unidentified-crashing/51203>\
**Category:** General JUCE discussion\
**Created:** [April 27, 2022, 2:28pm UTC](https://forum.juce.com/t/unidentified-crashing/51203 "2022-04-27T14:28:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dpynes](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/dpynes/32/22403_2.png) [@dpynes](https://forum.juce.com/u/dpynes)\
**Post date:** [April 27, 2022, 2:28pm UTC](https://forum.juce.com/t/unidentified-crashing/51203/1 "2022-04-27T14:28:33Z")

</div>

Dealing with crashes in DAW and can not determine the source of the problem…

At times when changing a value in the GUI on a slider there will be a crash…

The pattern between processor and editor is the following:

In the processor:

```auto
public:
        void prepareToPlay() noexcept
        {
            mixPtr = valueTreeState.getRawParameterValue(mixAttachment);
        }

        void update()
        {
            mixSmooth.setTargetValue(mixPtr->load());
        }

private:
        std::atomic<float>* mixPtr = nullptr;

```

In the editor:

```auto
public:
            //MIX//
            addAndMakeVisible(&slider01);
            sliderAttachment01.reset(new SliderAttachment(valueTreeState, mixAttachment, slider01));

```

All tests pass in PlugIn Val…

 ![PluginValTest](https://us1.discourse-cdn.com/flex026/uploads/juce/original/2X/3/3fa4b1b95231a4417b6391cc11b9ff611449e38c.png)

Now, a final potential issue, some processors are passed by reference to other processors to reference the values…For example, there’s an amplifier processor, with an ADSR, and so some other processor may want to use the current envelope value.

So the pattern may look like this…

```auto
        EffectProcessor(
            juce::String effectUnitAttachment_,
            juce::String effectUnitName_,
            juce::AudioProcessorValueTreeState& vts,
            AmplifierProcessor& amplifierControlsProcessor_
        ) 

```

Could this cause an unnoticed crash from a race condition reading/writing to a primitive, such as a float?

Any insight is appreciated.

---

<div class="post-metadata">

**Author:** ![reuk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/reuk/32/21494_2.png) [@reuk](https://forum.juce.com/u/reuk)\
**Post date:** [April 27, 2022, 3:09pm UTC](https://forum.juce.com/t/unidentified-crashing/51203/2 "2022-04-27T15:09:17Z")

</div>

Try building both your plugin and your host/test app with Address Sanitizer and Thread Sanitizer (you can’t enable both simultaneously, so try one and then the other), and then re-run the tests that cause the plugin to crash. At the point of the crash, you should see some helpful diagnostic messages that will help you to track down the problem.

---

<div class="post-metadata">

**Author:** ![dpynes](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/dpynes/32/22403_2.png) [@dpynes](https://forum.juce.com/u/dpynes)\
**Post date:** [April 28, 2022, 3:17am UTC](https://forum.juce.com/t/unidentified-crashing/51203/4 "2022-04-28T03:17:03Z")

</div>

Thread Sanitizer found the issue.

If anyone else stumbles on this…respect the critical section, which means never access data from the processor directly in the editor…best to use the value tree.
