How to use AudioProcessorValueTreeState's SliderAttachment?

this is my first time trying to use any of the audioProcessorParameter classes, so obviously i’m doing something really wrong here. Here’s what i have so far:
(and sorry, it’s a button i’m trying to connect at the moment, not a slider)

in my PluginProcessor.h, as a public variable:

AudioProcessorValueTreeState mainValueTree;

and then here are the first lines of my PluginProcessor’s constructor:

PluginProcessor::PluginProcessor()
:   mainValueTree (*this, nullptr)

{
    mainValueTree.state = ValueTree ("mainValueTree");

    NormalisableRange<float> buttonRange (0, 1, 1);
    mainValueTree.createAndAddParameter ("clockForwards", "ClockForwards", "clock forwards", buttonRange, 0, nullptr, nullptr);

and then in my GUIcomponent.h

AudioProcessorValueTreeState::ButtonAttachment* clockForwardsButtonAttachment;

and then finally, in the constructor of my GUIcomponent.cpp, after the clockForwards button is added, i have:

clockForwardsButtonAttachment = new AudioProcessorValueTreeState::ButtonAttachment (p.mainValueTree, "clockForwards", *clockForwards);

this doesn’t work, and gives me a seg fault. Obviously i’m doing it wrong, but quite in the dark here how to do it right.

(btw: clockFowards is just an ordinary text button, created with the projucer)