summaryrefslogtreecommitdiffhomepage
path: root/gui/main-window.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-09-09 22:50:10 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-09-09 22:50:10 +0200
commit0f5f3894da2f32e8a3787730f113cd09629ec80b (patch)
tree405ede5079437005475e4bc7368f5d680fb695eb /gui/main-window.cpp
parent13ed00e2fa661009075122b5a2659b91c8fc9a01 (diff)
gui/main-window: fix qt signals racing
tie_setting to tracker/filter/proto raced with connection that saved the modules into .ini on disk. Worse, the problem was swept under the rug by calling save_modules() in dtor.
Diffstat (limited to 'gui/main-window.cpp')
-rw-r--r--gui/main-window.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/gui/main-window.cpp b/gui/main-window.cpp
index 8d65c738..4daf7560 100644
--- a/gui/main-window.cpp
+++ b/gui/main-window.cpp
@@ -102,17 +102,20 @@ MainWindow::MainWindow() :
// dylibs
{
- connect(ui.iconcomboTrackerSource,
- &QComboBox::currentTextChanged,
- [&](QString) -> void { if (pTrackerDialog) pTrackerDialog = nullptr; save_modules(); });
+ connect(&m.tracker_dll,
+ static_cast<void(base_value::*)(const QString&) const>(&base_value::valueChanged),
+ this,
+ [&](const QString&) { if (pTrackerDialog) pTrackerDialog = nullptr; save_modules(); });
- connect(ui.iconcomboProtocol,
- &QComboBox::currentTextChanged,
- [&](QString) -> void { if (pProtocolDialog) pProtocolDialog = nullptr; save_modules(); });
+ connect(&m.protocol_dll,
+ static_cast<void(base_value::*)(const QString&) const>(&base_value::valueChanged),
+ this,
+ [&](const QString&) { if (pProtocolDialog) pProtocolDialog = nullptr; save_modules(); });
- connect(ui.iconcomboFilter,
- &QComboBox::currentTextChanged,
- [&](QString) -> void { if (pFilterDialog) pFilterDialog = nullptr; save_modules(); });
+ connect(&m.filter_dll,
+ static_cast<void(base_value::*)(const QString&) const>(&base_value::valueChanged),
+ this,
+ [&](const QString&) { if (pFilterDialog) pFilterDialog = nullptr; save_modules(); });
}
tie_setting(m.tracker_dll, ui.iconcomboTrackerSource);
@@ -261,7 +264,6 @@ MainWindow::~MainWindow()
if (tray)
tray->hide();
stopTracker();
- save_modules();
}
void MainWindow::set_working_directory()