From 9d84fa654f1a234f482d289bbd85740c427036bb Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 24 Dec 2016 23:14:07 +0100 Subject: options/tie: clarify threading logic Forcefully run in the widget's thread in both signal cases. If the connection is made and the widget's moved to another thread after, we'll observe the "epileptic slider" issue again. Clarify by explicitly using Qt::DirectConnection. --- options/tie.hpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'options') diff --git a/options/tie.hpp b/options/tie.hpp index 49b8fd1b..544d4d87 100644 --- a/options/tie.hpp +++ b/options/tie.hpp @@ -148,17 +148,21 @@ inline void tie_setting(value& v, QSlider* w) w->setValue(v().to_slider_pos(q_min, q_max)); }); }, - v.DIRECT_CONNTYPE); + Qt::DirectConnection); base_value::connect(&v, static_cast(&base_value::valueChanged), w, [=, &v](double) { - const int q_min = w->minimum(); - const int q_max = w->maximum(); - w->setValue(v().to_slider_pos(q_min, q_max)); - v = v().update_from_slider(w->value(), q_min, q_max); + 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); + w->setValue(pos); + v = v().update_from_slider(w->value(), q_min, q_max); + }); }, - v.SAFE_CONNTYPE); + Qt::DirectConnection); } } -- cgit v1.2.3