About TabbedComponent

In my application I have some TabbedComponents displaying some Components.
I created some algorithms in order to detach a displayed Component and put it into a DocumentWindow.
When doing this I need to call removeTab from the desired TabbedComponent,
and then create the DocumentWindow and call setContentComponent(ComponentToDisplay) in the DocumentWindow.
The problem is that calling TabbedComponent::removeTab destroys the displayed Component.
So I can’t put the Component into the window.
Is there any workarounds?
Do you have any suggestions?


look at the argument deleteComponentWhenNotNeeded

… and that was the issue!
Thanks kraken, that was a stupid mistake. It must be the heatwave of these days!