diff options
-rw-r--r-- | options/connector.cpp | 8 | ||||
-rw-r--r-- | options/connector.hpp | 4 | ||||
-rw-r--r-- | options/value.hpp | 6 |
3 files changed, 11 insertions, 7 deletions
diff --git a/options/connector.cpp b/options/connector.cpp index 4ba532d4..f23db06d 100644 --- a/options/connector.cpp +++ b/options/connector.cpp @@ -6,12 +6,12 @@ namespace detail { connector::~connector() {} -void connector::on_bundle_destructed(const QString& name, const base_value* val) +void connector::on_value_destructed(const QString& name, const base_value* val) { QMutexLocker l(get_mtx()); auto it = connected_values.find(name); - if (it != connected_values.end()) + if (it != connected_values.cend()) { std::vector<const base_value*>& values = (*it).second; for (auto it = values.begin(); it != values.end(); ) @@ -25,7 +25,7 @@ void connector::on_bundle_destructed(const QString& name, const base_value* val) } } -void connector::on_bundle_created(const QString& name, const base_value* val) +void connector::on_value_created(const QString& name, const base_value* val) { QMutexLocker l(get_mtx()); auto it = connected_values.find(name); @@ -46,7 +46,7 @@ void connector::on_bundle_created(const QString& name, const base_value* val) void connector::notify_values(const QString& name) const { auto it = connected_values.find(name); - if (it != connected_values.end()) + if (it != connected_values.cend()) { for (const base_value* val : (*it).second) { diff --git a/options/connector.hpp b/options/connector.hpp index dea9fd0f..ef9e4dbf 100644 --- a/options/connector.hpp +++ b/options/connector.hpp @@ -20,8 +20,8 @@ class OPENTRACK_OPTIONS_EXPORT connector std::map<QString, std::vector<const base_value*>> connected_values; - void on_bundle_destructed(const QString& name, const base_value* val); - void on_bundle_created(const QString& name, const base_value* val); + void on_value_destructed(const QString& name, const base_value* val); + void on_value_created(const QString& name, const base_value* val); protected: void notify_values(const QString& name) const; diff --git a/options/value.hpp b/options/value.hpp index 4d067af1..f0ecf0c7 100644 --- a/options/value.hpp +++ b/options/value.hpp @@ -31,7 +31,11 @@ public: QString name() const { return self_name; } base_value(bundle b, const QString& name) : b(b), self_name(name) { - b->on_bundle_created(name, this); + b->on_value_created(name, this); + } + ~base_value() override + { + b->on_value_destructed(self_name, this); } signals: OPENTRACK_DEFINE_SIGNAL(double); |