Changing Juce::Slider properties interrupts use of the slider

Nice idea.
I think it can be improved further: there is no need to keep the label pointer, removing any chance to get a dangling pointer.
This is all you need:

    // this will be called whenever a child component is added or
    // removed
    void childrenChanged() override
    {
        updateLabelColours();
    }

    void updateLabelColours()
    {
        if (auto* label =findLabel())
        {

            // This is code effectively taken from juce::LookAndFeel_V2::createSliderTextBox()
            // it is the colours that will be used for a LinearBar or LinearBarVertical slider
            // in almost all cases, feel free to change them if needed, but generally using
            // setColour on the slider should be sufficient
            label->setColour (Label::textColourId, findColour (Slider::textBoxTextColourId));
            label->setColour (Label::backgroundColourId, Colours::transparentBlack);
            label->setColour (Label::outlineColourId, findColour (Slider::textBoxOutlineColourId));

            label->setColour (TextEditor::textColourId, findColour (Slider::textBoxTextColourId));
            label->setColour (TextEditor::backgroundColourId, findColour (Slider::textBoxBackgroundColourId).withAlpha (0.7f));
            label->setColour (TextEditor::outlineColourId, findColour (Slider::textBoxOutlineColourId));
            label->setColour (TextEditor::highlightColourId, findColour (Slider::textBoxHighlightColourId));
        }
    }

But if you want to keep it, I would recommend using a
juce::Component::SafePointer<juce::Label> label;

2 Likes