Unidentified crashing

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:

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

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

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

In the editor:

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

All tests pass in PlugIn Val…

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…

        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.

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.

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.