diff --git a/effects/internal/vsthost.cpp b/effects/internal/vsthost.cpp index 9f8334dfb..bdd007ecd 100644 --- a/effects/internal/vsthost.cpp +++ b/effects/internal/vsthost.cpp @@ -299,21 +299,22 @@ void VSTHost::save(QXmlStreamWriter &stream) { } void VSTHost::show_interface(bool show) { -#if defined(_WIN32) - dispatcher(plugin, effEditOpen, 0, 0, reinterpret_cast(dialog->winId()), 0); -#elif defined(__APPLE__) - dispatcher(plugin, effEditOpen, 0, 0, reinterpret_cast(dialog->winId()), 0); -#elif defined(__linux__) - Window xwindow = dialog->windowHandle()->winId(); - dispatcher(plugin, effEditOpen, 0, 0, reinterpret_cast(xwindow), 0); -#endif + dialog->setVisible(show); - dialog->setVisible(show); + if (show) { +#if defined(_WIN32) + dispatcher(plugin, effEditOpen, 0, 0, reinterpret_cast(dialog->windowHandle()->winId()), 0); +#elif defined(__APPLE__) + dispatcher(plugin, effEditOpen, 0, 0, reinterpret_cast(dialog->windowHandle()->winId()), 0); +#elif defined(__linux__) + dispatcher(plugin, effEditOpen, 0, 0, reinterpret_cast(dialog->windowHandle()->winId()), 0); +#endif + } else { + dispatcher(plugin, effEditClose, 0, 0, nullptr, 0); + } } void VSTHost::uncheck_show_button() { - dispatcher(plugin, effEditClose, 0, 0, nullptr, 0); - show_interface_btn->setChecked(false); }