summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2022-01-26 02:17:29 +0100
committerStanislaw Halik <sthalik@misaki.pl>2022-01-26 02:17:29 +0100
commitb29b8e48fe59f44fd28de5f6879730bcdf34a9dd (patch)
treeef61afc6c336e9cb7c73ffca91a80370f3c0774f
parentefab199484d2b5f1b333257b052a71eef2f4be8a (diff)
api, opentrack: fix the crash for real this time
-rw-r--r--api/plugin-api.cpp2
-rw-r--r--opentrack/main-window.cpp8
2 files changed, 4 insertions, 6 deletions
diff --git a/api/plugin-api.cpp b/api/plugin-api.cpp
index ef9e47a1..3bf4b37b 100644
--- a/api/plugin-api.cpp
+++ b/api/plugin-api.cpp
@@ -9,7 +9,7 @@ void BaseDialog::closeEvent(QCloseEvent*)
if (isVisible())
{
emit closing();
- close();
+ reject();
}
}
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<t>& d, bool show, Args&&... params)
{
bool fresh = false;
- if (!d)
+ if (!(d && d->isVisible()))
{
d = std::make_unique<t>(std::forward<Args>(params)...);
fresh = !!d;
@@ -664,7 +664,7 @@ static void show_module_settings(std::shared_ptr<Instance> instance,
if (!lib || !lib->Dialog)
return;
- bool fresh = !dialog;
+ bool fresh = !(dialog && dialog->isVisible());
if (fresh)
dialog = std::unique_ptr<Dialog>{(Dialog*)lib->Dialog()};
bool embed = dialog->embeddable() && win->module_tabs_enabled();
@@ -675,7 +675,6 @@ static void show_module_settings(std::shared_ptr<Instance> 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)
{