From 6d39be4570eb0dd8b76fb3319d89ab687cb38362 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 21 Aug 2016 22:17:58 +0200 Subject: spline-widget: return mem and not settings& --- spline-widget/spline-widget.cpp | 5 +++-- spline-widget/spline.cpp | 8 ++++---- spline-widget/spline.hpp | 5 ++--- 3 files changed, 9 insertions(+), 9 deletions(-) (limited to 'spline-widget') 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 #include @@ -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 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::get_settings() { QMutexLocker foo(&_mutex); - return *s; + return s; } -const spline::settings& spline::get_settings() const +mem spline::get_settings() const { QMutexLocker foo(&_mutex); - return *s; + return s; } int spline::precision(const QList& 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& 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 get_settings(); + mem get_settings() const; using points_t = decltype(s->points.get()); }; -- cgit v1.2.3