From 321501ad58dad2688bde42992b61adcda5a313e0 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 21 Aug 2016 22:22:51 +0200 Subject: options/bundle: simplify mutex const-dropping --- options/bundle.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'options/bundle.cpp') diff --git a/options/bundle.cpp b/options/bundle.cpp index 644fe4c6..aa7d0ea8 100644 --- a/options/bundle.cpp +++ b/options/bundle.cpp @@ -49,7 +49,7 @@ void bundle::store_kv(const QString& name, const QVariant& datum) bool bundle::contains(const QString &name) const { - QMutexLocker l(const_cast(&mtx)); + QMutexLocker l(mtx); return transient.contains(name); } @@ -80,9 +80,9 @@ void bundle::save() save_deferred(*group::ini_file()); } -bool bundle::modifiedp() const // XXX unused +bool bundle::is_modified() const // XXX unused { - QMutexLocker l(const_cast(&mtx)); + QMutexLocker l(mtx); return transient != saved; } @@ -155,11 +155,9 @@ OPENTRACK_OPTIONS_EXPORT bundler& singleton() return ret; } -} - -// end options::detail +} // end options::detail -OPENTRACK_OPTIONS_EXPORT bundle make_bundle(const QString& name) +OPENTRACK_OPTIONS_EXPORT std::shared_ptr make_bundle(const QString& name) { if (name.size()) return detail::singleton().make_bundle(name); @@ -167,5 +165,6 @@ OPENTRACK_OPTIONS_EXPORT bundle make_bundle(const QString& name) return std::make_shared(QStringLiteral("")); } -} // end options +QMutex* options::detail::bundle::get_mtx() const { return mtx; } +} // end options -- cgit v1.2.3