Hello,
I have been creating some custom views following the helpful documentation supplied on this page;
https://steinbergmedia.github.io/vst3_doc/vstgui/html/md_page_create_your_own_ui_view.html
I was successfully able to create some knobs and sliders which was terrific.
However I’ve hit a serious issue, involving a memory leak which is stemming from my implementation of MyControlFactory.cpp
My slider control registration class looks like this.
class MyControlFactory4 : public ViewCreatorAdapter {
public: // register this class with the view factory
MyControlFactory4() { UIViewFactory::registerViewCreator(*this); }
IdStringPtr getViewName() const override { return “hoz slide”; }
IdStringPtr getBaseViewName() const override { return UIViewCreator::kCSlider; }
CView* create(const UIAttributes& attributes, const IUIDescription* description) const override {
CSlider *sli = new CSlider(CRect(0, 0, 70, 70), nullptr, -1, 0, 1, nullptr, nullptr);
return new MyHozslide(* sli );
}
};
I can see that the problem lies in declaring the slider with new but then not deleting it, which I can’t figure out how to do.
But perhaps there is another way of declaring a CSlider without using new.
Any thought on how to approach this problem would be massively appreciated.
Thanks,
James