TabbedComponent removeTab issue


#1

I create a tabbed component, add 3 tabs each with no content component (passing 0 and false for the delete if not used parameter, that’s how the old jucer did it)
and when i try to delete those tabs later on, i get an error in this call, i guess the “c” pointer should be 0 but it’s not and the if (c!=0) tries to execute anyway.
Did something change, do we have to pass a component to the tabs now ?

void TabbedComponent::removeTab (const int tabIndex)
{
    WeakReference<Component>* c = contentComponents [tabIndex];

    if (c != 0)
    {
        if ((bool) ((*c)->getProperties() [deleteComponentId]))
            delete c->get();

        contentComponents.remove (tabIndex);
        tabs->removeTab (tabIndex);
    }
}

#2

Ah… I guess it should just read

if (c != 0 && *c != 0)

I don’t use null pointers for tabs myself, though it should deal with them. Thanks for spotting it!


#3

well i’m afraid i’m doing a jucer like component designer so i need to have empty tabs at least until the user says otherwise.

thank you.


#4

BTW my suggestion there wasn’t 100% correct - I’m just tidying the class up properly, will be sorted out in my next check-in…