summaryrefslogtreecommitdiffhomepage
path: root/options/bundle.hpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2018-12-20 18:23:14 +0100
committerStanislaw Halik <sthalik@misaki.pl>2018-12-24 19:31:24 +0100
commite81df263f4123a39fe6d4d50fb21f47dd242e796 (patch)
tree4b8cd13da31ac3fb3a2d2695b65595d7c5570439 /options/bundle.hpp
parent2613beb8028ecac53548d311b27ff38559763f6c (diff)
remove const correctness violations
This is possibly related to a livelock where several threads do const removal in their respective code paths. Use the `mutable' specifier for the mutexes and spline's cached data. Now using the `mutable' specifier, get rid of <optional> in compat/mutex.
Diffstat (limited to 'options/bundle.hpp')
-rw-r--r--options/bundle.hpp15
1 files changed, 4 insertions, 11 deletions
diff --git a/options/bundle.hpp b/options/bundle.hpp
index 9ab7f74c..4c2b9781 100644
--- a/options/bundle.hpp
+++ b/options/bundle.hpp
@@ -29,13 +29,6 @@
#include "export.hpp"
namespace options::detail {
- class OTR_OPTIONS_EXPORT mutex final : public QMutex
- {
- public:
- explicit mutex(QMutex::RecursionMode mode);
- cc_noinline operator QMutex*() const; // NOLINT
- };
-
class bundle;
} // ns options::detail
@@ -51,7 +44,7 @@ class OTR_OPTIONS_EXPORT bundle final : public QObject, public connector
{
Q_OBJECT
- mutex mtx;
+ mutable QMutex mtx { QMutex::Recursive };
const QString group_name;
group saved;
group transient;
@@ -65,7 +58,7 @@ public:
bundle(const bundle&) = delete;
bundle& operator=(const bundle&) = delete;
- QMutex* get_mtx() const override { return mtx; }
+ QMutex* get_mtx() const override { return &mtx; }
QString name() const { return group_name; }
explicit bundle(const QString& group_name);
@@ -100,8 +93,8 @@ private:
friend OTR_OPTIONS_EXPORT
std::shared_ptr<v> options::make_bundle(const QString& name);
- [[nodiscard]] std::shared_ptr<v> make_bundle_(const k& key);
- [[nodiscard]] static bundler& bundler_singleton();
+ std::shared_ptr<v> make_bundle_(const k& key);
+ static bundler& bundler_singleton();
bundler();
~bundler();