The TabbedComponent cause memory leak?

Hello, everyone! I got problem when using the TabbedComponent, below is the MainContentComponent:
 

class MainContentComponent   : public Component
{
public:
    //==============================================================================
    MainContentComponent()
        : spTc(TabbedButtonBar::TabsAtTop)
    {
        spTc.addTab("Main", Colour(0xffeeddff), new TextButton("hello"), false);
        addAndMakeVisible(spTc);
        setSize(500, 400);
    }
    ~MainContentComponent()
    {

    }

    void paint(Graphics& g)
    {
        g.fillAll (Colour (0xffeeddff));
    }

    void resized()
    {
        spTc.setBounds(getBounds());
    }

private:
    TabbedComponent spTc;
    //==============================================================================
    JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MainContentComponent)
};

This code get an unhandled exception when exiting, The code crashed at  juce_win32_Windowing.cpp Line 1643.

Then I changed the TabbedComponent spTc to SafePointer<TabbedComponent> spTc, and then the program get a memory leak of when exiting: *** Leaked objects detected: 1 instance(s) of class TabBarButton

How to use the TabbedComponent, can someone help me?

 

You've allocated a new TextButton with addTab() without keeping a reference to it for later deletion. If you're going to do this then you need to set deleteComponentWhenNotNeeded to true so the TabbedComponent takes ownership and deletes it for you.

The leaked object is the TabBarButton, not the TextButton.  I did firstly set the deleteComponentWhenNotNeeded to true . That cause the same leak of TabBarButton.