summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2021-10-15 23:58:49 +0200
committerStanislaw Halik <sthalik@misaki.pl>2021-10-16 18:20:50 +0200
commit6d953ab8a790312c46c04264a328741c949ad830 (patch)
tree93e3b5f6776efa48ff6dfad74ac4ea0e4c89ff72
parentb9a4d906f1cde54ba05dd8be8d4971f0fa51d98e (diff)
options/opts: allow disable raii guard
-rw-r--r--options/scoped.cpp2
-rw-r--r--options/scoped.hpp4
2 files changed, 5 insertions, 1 deletions
diff --git a/options/scoped.cpp b/options/scoped.cpp
index f5e219e2..9cbc826c 100644
--- a/options/scoped.cpp
+++ b/options/scoped.cpp
@@ -47,7 +47,7 @@ static bool is_tracker_teardown()
opts::~opts()
{
- if (!is_tracker_teardown())
+ if (!is_tracker_teardown() && raii)
b->reload();
#if 0
else
diff --git a/options/scoped.hpp b/options/scoped.hpp
index dd7dbacf..81e6bd19 100644
--- a/options/scoped.hpp
+++ b/options/scoped.hpp
@@ -27,9 +27,13 @@ struct OTR_OPTIONS_EXPORT opts
opts& operator=(const opts&) = delete;
opts(const opts&) = delete;
+ void set_raii_dtor_state(bool x) { raii = x; }
+
protected:
explicit opts(const QString& name);
~opts();
+private:
+ bool raii = true;
};
}