diff options
Diffstat (limited to 'spline-widget')
-rw-r--r-- | spline-widget/spline-widget.cpp | 5 | ||||
-rw-r--r-- | spline-widget/spline.cpp | 8 | ||||
-rw-r--r-- | spline-widget/spline.hpp | 5 |
3 files changed, 9 insertions, 9 deletions
diff --git a/spline-widget/spline-widget.cpp b/spline-widget/spline-widget.cpp index ce16f7be..54107bbe 100644 --- a/spline-widget/spline-widget.cpp +++ b/spline-widget/spline-widget.cpp @@ -5,6 +5,7 @@ * copyright notice and this permission notice appear in all copies. */ +#include "compat/util.hpp" #include "spline-widget.hpp" #include <QPainter> #include <QPaintEvent> @@ -40,8 +41,8 @@ void spline_widget::setConfig(spline* spl) if (spl) { - spline::settings& s = spl->get_settings(); - connection = connect(&s, &spline::settings::recomputed, + mem<spline::settings> s = spl->get_settings(); + connection = connect(s.get(), &spline::settings::recomputed, this, [this]() { reload_spline(); }, Qt::QueuedConnection); } diff --git a/spline-widget/spline.cpp b/spline-widget/spline.cpp index a84f0d05..4f60181e 100644 --- a/spline-widget/spline.cpp +++ b/spline-widget/spline.cpp @@ -373,16 +373,16 @@ void spline::recompute() } // the return value is only safe to use with no spline::set_bundle calls -spline::settings& spline::get_settings() +mem<spline::settings> spline::get_settings() { QMutexLocker foo(&_mutex); - return *s; + return s; } -const spline::settings& spline::get_settings() const +mem<const spline::settings> spline::get_settings() const { QMutexLocker foo(&_mutex); - return *s; + return s; } int spline::precision(const QList<QPointF>& points) const diff --git a/spline-widget/spline.hpp b/spline-widget/spline.hpp index 5d521a6c..0ffc4de9 100644 --- a/spline-widget/spline.hpp +++ b/spline-widget/spline.hpp @@ -40,7 +40,6 @@ signals: class OPENTRACK_SPLINE_EXPORT spline final { -private: int precision(const QList<QPointF>& points) const; void update_interp_data(); float getValueInternal(int x); @@ -104,8 +103,8 @@ public: bundle get_bundle(); void recompute(); - settings& get_settings(); - const settings& get_settings() const; + mem<settings> get_settings(); + mem<const settings> get_settings() const; using points_t = decltype(s->points.get()); }; |