2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-07 18:15:15 +00:00

Improve base::binary_guard interface.

This commit is contained in:
John Preston
2019-03-27 16:11:38 +04:00
parent efb2972d28
commit d3bf489bea
12 changed files with 38 additions and 54 deletions

View File

@@ -88,10 +88,11 @@ void Databases::destroy(Cache::Database *database) {
auto &kept = entry.second;
if (kept.database.get() == database) {
Assert(!kept.destroying.alive());
auto [first, second] = base::make_binary_guard();
kept.destroying = std::move(first);
database->close();
database->waitForCleaner([=, guard = std::move(second)]() mutable {
database->waitForCleaner([
=,
guard = kept.destroying.make_guard()
]() mutable {
crl::on_main(std::move(guard), [=] {
_map.erase(path);
});