accounts: remove Arc and RwLock from Accounts.accounts

Also make Accounts uncloneable. It is still possible to derive Clone,
but does not make sense to do so, as .clone() creates two separate
account managers which use the same files but different unsynchronized
in-memory data structures.
This commit is contained in:
link2xt
2021-09-04 13:38:14 +00:00
parent aa2e03382b
commit d33177a721
2 changed files with 36 additions and 43 deletions

View File

@@ -3782,7 +3782,7 @@ pub unsafe extern "C" fn dc_accounts_add_account(accounts: *mut dc_accounts_t) -
return 0;
}
let accounts = &*accounts;
let accounts = &mut *accounts;
block_on(accounts.add_account()).unwrap_or(0)
}
@@ -3797,7 +3797,7 @@ pub unsafe extern "C" fn dc_accounts_remove_account(
return 0;
}
let accounts = &*accounts;
let accounts = &mut *accounts;
block_on(accounts.remove_account(id))
.map(|_| 1)
@@ -3814,7 +3814,7 @@ pub unsafe extern "C" fn dc_accounts_migrate_account(
return 0;
}
let accounts = &*accounts;
let accounts = &mut *accounts;
let dbfile = to_string_lossy(dbfile);
block_on(accounts.migrate_account(async_std::path::PathBuf::from(dbfile)))