I’m populating an OwnedArray with TextButton pointers in the PluginEditor constructor only for them to apparently all be deleted by the time resized() is called. Is resized() being called before PluginEditor is created, for some reason? Or is there a semantic of OwnedArray I’m missing?
Although, since addAndMakeVisible() is a method of the base class anyway, it probably has nothing to do with it… It may take better eyes than mine to see the problem!
Yes, the dynamic_cast shouldn’t be there at all. But it doesn’t do anything in this particular case.
The setSize() call triggers resized(). Since your setSize() call occurs at the beginning, the resized has nothing to layout. If you look at the size of muteBtns it will show 0.
If you move the setSize() to the end of the constructor after all the child components are constructed, it should be better.
(The original comment above setSize() even says that )