vstgui: fix various ownership problems

This commit is contained in:
Jean Pierre Cimalando 2020-09-05 01:23:10 +02:00
parent acce5d44f5
commit 0205aca375
2 changed files with 9 additions and 7 deletions

View file

@ -131,6 +131,8 @@ Editor::~Editor()
{
Impl& impl = *impl_;
close();
EditorController& ctrl = *impl.ctrl_;
ctrl.decorate(nullptr);
}
@ -148,7 +150,7 @@ void Editor::close()
Impl& impl = *impl_;
if (impl.frame_) {
impl.frame_->removeView(impl.view_.get());
impl.frame_->removeView(impl.view_.get(), false);
impl.frame_ = nullptr;
}
}
@ -284,11 +286,11 @@ void Editor::Impl::createFrameContents()
{
const CRect bounds { 0.0, 0.0, static_cast<CCoord>(viewWidth), static_cast<CCoord>(viewHeight) };
CViewContainer* view = new CViewContainer(bounds);
view_ = view;
view_ = owned(view);
view->setBackgroundColor(CColor(0xff, 0xff, 0xff));
SharedPointer<CBitmap> logo { new CBitmap("logo.png") };
SharedPointer<CBitmap> logo = owned(new CBitmap("logo.png"));
CRect bottomRow = bounds;
bottomRow.top = bottomRow.bottom - 30;
@ -688,7 +690,7 @@ void Editor::Impl::createFrameContents()
void Editor::Impl::chooseSfzFile()
{
SharedPointer<CNewFileSelector> fs(CNewFileSelector::create(frame_));
SharedPointer<CNewFileSelector> fs = owned(CNewFileSelector::create(frame_));
fs->setTitle("Load SFZ file");
fs->setDefaultExtension(CFileExtension("SFZ", "sfz"));
@ -705,7 +707,7 @@ void Editor::Impl::chooseSfzFile()
void Editor::Impl::chooseScalaFile()
{
SharedPointer<CNewFileSelector> fs(CNewFileSelector::create(frame_));
SharedPointer<CNewFileSelector> fs = owned(CNewFileSelector::create(frame_));
fs->setTitle("Load Scala file");
fs->setDefaultExtension(CFileExtension("SCL", "scl"));

View file

@ -86,8 +86,8 @@ struct sfizz_ui_t : EditorController, VSTGUIEditorInterface {
LV2_URID_Unmap *unmap = nullptr;
LV2UI_Resize *resize = nullptr;
LV2UI_Touch *touch = nullptr;
std::unique_ptr<Editor> editor;
FrameHolder uiFrame;
std::unique_ptr<Editor> editor;
#if LINUX
SharedPointer<Lv2IdleRunLoop> runLoop;
#endif
@ -191,7 +191,7 @@ instantiate(const LV2UI_Descriptor *descriptor,
IPlatformFrameConfig* config = nullptr;
#if LINUX
SharedPointer<Lv2IdleRunLoop> runLoop = new Lv2IdleRunLoop;
SharedPointer<Lv2IdleRunLoop> runLoop = owned(new Lv2IdleRunLoop);
self->runLoop = runLoop;
VSTGUI::X11::FrameConfig x11Config;
x11Config.runLoop = runLoop;