mu-store: auto-commit store in dtor

This commit is contained in:
Dirk-Jan C. Binnema 2020-02-17 22:29:44 +02:00
parent 0b4dee6996
commit c4c56fa7f0
1 changed files with 6 additions and 5 deletions

View File

@ -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<Xapian::Database> 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)
{