I am using a viewport that works fine. I create a component to which I dynamically add controls. It resizes as the program runs. I use setViewedComponent to add it to the viewport and all is well. I get a nice scrolling area of controls.
But when I exit, I get Block type is invalid assert failed as it seems to try to destruct the viewed object which is owned by the MainComponent window whcih is creating all of the controls on it, so it appears to have been already destroyed.
I tried adding viewedComponentChanged(0) to remove it in both the MainComponent destructor and my Viewport class destructor, no effect.
How do I correctly disentangle the viewport so it doesn’t always crash at program exit?