From b29b8e48fe59f44fd28de5f6879730bcdf34a9dd Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Wed, 26 Jan 2022 02:17:29 +0100 Subject: api, opentrack: fix the crash for real this time --- opentrack/main-window.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'opentrack') diff --git a/opentrack/main-window.cpp b/opentrack/main-window.cpp index 26da2f67..c514f304 100644 --- a/opentrack/main-window.cpp +++ b/opentrack/main-window.cpp @@ -635,7 +635,7 @@ static bool mk_window(std::unique_ptr& d, bool show, Args&&... params) { bool fresh = false; - if (!d) + if (!(d && d->isVisible())) { d = std::make_unique(std::forward(params)...); fresh = !!d; @@ -664,7 +664,7 @@ static void show_module_settings(std::shared_ptr instance, if (!lib || !lib->Dialog) return; - bool fresh = !dialog; + bool fresh = !(dialog && dialog->isVisible()); if (fresh) dialog = std::unique_ptr{(Dialog*)lib->Dialog()}; bool embed = dialog->embeddable() && win->module_tabs_enabled(); @@ -675,7 +675,6 @@ static void show_module_settings(std::shared_ptr instance, { if (instance) ((*dialog).*register_fun)(&*instance); - QObject::connect(&*dialog, &BaseDialog::closing, win, [&] { dialog = nullptr; }); } if (show) show_window(*dialog, fresh); @@ -712,7 +711,7 @@ void main_window::show_filter_settings_(bool show) void main_window::show_options_dialog(bool show) { - if (options_widget) + if (options_widget && options_widget->isVisible()) { if (show) show_window(*options_widget, false); @@ -738,7 +737,6 @@ void main_window::show_options_dialog(bool show) embed ? pProtocolDialog : empty_IPD, embed ? pFilterDialog : empty_IFD, [this](bool flag) { set_keys_enabled(!flag); }); - connect(&*options_widget, &options_dialog::closing, this, [this] { options_widget = nullptr; }); if (work) { -- cgit v1.2.3