From c4c56fa7f0c182512124ad807790347205cd4dfb Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Mon, 17 Feb 2020 22:29:44 +0200 Subject: [PATCH] mu-store: auto-commit store in dtor --- lib/mu-store.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/mu-store.cc b/lib/mu-store.cc index 896d2a7f..4154fd16 100644 --- a/lib/mu-store.cc +++ b/lib/mu-store.cc @@ -133,8 +133,13 @@ struct Store::Private { } ~Private() { - if (wdb()) + LOCKED; + if (wdb()) { wdb()->set_metadata (ContactsKey, contacts_.serialize()); + if (in_transaction_) // auto-commit. + wdb()->commit_transaction(); + } + } std::shared_ptr db() const { @@ -442,8 +447,6 @@ Store::cancel_transaction () try bool Store::in_transaction () const { - LOCKED; - return priv_->in_transaction_; } @@ -1405,8 +1408,6 @@ mu_store_get_dirstamp (const MuStore *store, const char *dirpath, GError **err) return self(store)->dirstamp(dirpath); } - - void mu_store_print_info (const MuStore *store, gboolean nocolor) {