From 0f5f3894da2f32e8a3787730f113cd09629ec80b Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 9 Sep 2016 22:50:10 +0200 Subject: 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. --- gui/main-window.cpp | 22 ++++++++++++---------- 1 file 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(&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(&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(&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() -- cgit v1.2.3