Can I reuse controls when GUI is opened and closed?

Hey! First of all thank you so much for your continued support of VSTGUI, I’m not sure I ever would have got into making VST’s without it and it’s a really fantastic thing.

I’m sorry if this has already been asked somewhere, I took a look around and couldn’t find an answer. I’m wondering if I can reuse CControl/CBitmap/etc instances between UI opens and closes, or do I need to recreate these from scratch every time the UI opens? Currently I’m creating the controls once, then calling “removeView” on all controls when PluginGUIEditor::close() is called, and then re-adding them with “addView” on PluginGUIEditor::open(). When the VST is terminated (removed), I call forget() on all the controls to do final cleanup.

This seems to be working without any trouble, but I got a crash related to changing frames on a bitmap at one point which led me to worry that this isn’t the way to be doing things. I haven’t been able to reproduce the crash, but I wanted to ask about the proper control etiquette here just to make sure I’m not setting myself up for disaster. (Edit: It turns out the crash was unrelated and caused by updating a bitmap frame from the Mixer thread instead of from the GUI thread. Still curious what the right way is, though!)

Thank you for your help!

I think it’s fine how you do this. But it is also OK to rebuild the views/controls every time you open the editor.
It all depends on what you find more important, memory usage or open performance.

Thanks for the response, glad to hear I don’t have to worry about re-using controls!