summaryrefslogtreecommitdiffhomepage
path: root/options/tie.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2021-10-19 03:47:47 +0200
committerStanislaw Halik <sthalik@misaki.pl>2021-10-19 05:50:54 +0200
commit2ef545b487209fb03bc2506b8e9bfa345d0f392b (patch)
tree7d0a551cdc9962002048b642016be6192eed2651 /options/tie.cpp
parente9a4a44ddebebfde2b1dc5e607336f241821175b (diff)
options/tie: fix deadlocks
Diffstat (limited to 'options/tie.cpp')
-rw-r--r--options/tie.cpp47
1 files changed, 14 insertions, 33 deletions
diff --git a/options/tie.cpp b/options/tie.cpp
index 43e6c596..337843b1 100644
--- a/options/tie.cpp
+++ b/options/tie.cpp
@@ -58,16 +58,11 @@ void tie_setting(value<QVariant>& v, QComboBox* cb)
v = {};
value_::connect(cb, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
- &v, [cb, &v](int idx) {
- v = cb->itemData(idx);
- }, v.DIRECT_CONNTYPE);
+ &v, [cb, &v](int idx) { v = cb->itemData(idx); },
+ v.DIRECT_CONNTYPE);
value_::connect(&v, value_::value_changed<QVariant>(),
- cb,
- [cb, set_idx](const QVariant& var) {
- run_in_thread_sync(cb, [&] {
- set_idx(var);
- });
- }, v.DIRECT_CONNTYPE);
+ cb, [set_idx](const QVariant& var) { set_idx(var); },
+ v.SAFE_CONNTYPE);
}
void tie_setting(value<bool>& v, QRadioButton* cb)
@@ -128,35 +123,21 @@ void tie_setting(value<slider_value>& v, QSlider* w)
v = v().update_from_slider(w->value(), q_min, q_max);
}
- value_::connect(w,
- &QSlider::valueChanged,
- &v,
- [=, &v](int pos)
+ value_::connect(w, &QSlider::valueChanged, &v, [=, &v](int pos)
{
- run_in_thread_sync(w, [&]()
- {
- const int q_min = w->minimum();
- const int q_max = w->maximum();
- v = v().update_from_slider(pos, q_min, q_max);
- w->setValue(v().to_slider_pos(q_min, q_max));
- });
+ int q_min = w->minimum();
+ int q_max = w->maximum();
+ v = v->update_from_slider(pos, q_min, q_max);
},
v.DIRECT_CONNTYPE);
- value_::connect(&v,
- value_::value_changed<slider_value>(),
- w,
- [=, &v](double) {
- run_in_thread_sync(w, [=, &v]()
- {
- const int q_min = w->minimum();
- const int q_max = w->maximum();
- const int pos = v->to_slider_pos(q_min, q_max);
- v = v->update_from_slider(pos, q_min, q_max);
- w->setValue(pos);
- });
+ value_::connect(&v, value_::value_changed<slider_value>(), w, [=, &v](double) {
+ const int q_min = w->minimum();
+ const int q_max = w->maximum();
+ const int pos = v->to_slider_pos(q_min, q_max);
+ w->setValue(pos);
},
- v.DIRECT_CONNTYPE);
+ v.SAFE_CONNTYPE);
}
} // ns options