fix: Try clear and try close database
This commit is contained in:
parent
bb9a8ff7e9
commit
d1b76b01c4
|
|
@ -947,14 +947,22 @@ class Client extends MatrixApi {
|
||||||
/// Resets all settings and stops the synchronisation.
|
/// Resets all settings and stops the synchronisation.
|
||||||
Future<void> clear() async {
|
Future<void> clear() async {
|
||||||
Logs().outputEvents.clear();
|
Logs().outputEvents.clear();
|
||||||
await database?.clear(id);
|
try {
|
||||||
|
await database?.clear(id);
|
||||||
|
} catch (e, s) {
|
||||||
|
Logs().e('Unable to clear database', e, s);
|
||||||
|
}
|
||||||
_id = accessToken = syncFilterId =
|
_id = accessToken = syncFilterId =
|
||||||
homeserver = _userID = _deviceID = _deviceName = prevBatch = null;
|
homeserver = _userID = _deviceID = _deviceName = prevBatch = null;
|
||||||
_rooms = [];
|
_rooms = [];
|
||||||
encryption?.dispose();
|
encryption?.dispose();
|
||||||
encryption = null;
|
encryption = null;
|
||||||
if (databaseDestroyer != null) {
|
if (databaseDestroyer != null) {
|
||||||
await database?.close();
|
try {
|
||||||
|
await database?.close();
|
||||||
|
} catch (e, s) {
|
||||||
|
Logs().e('Unable to close database', e, s);
|
||||||
|
}
|
||||||
await databaseDestroyer(this);
|
await databaseDestroyer(this);
|
||||||
_database = null;
|
_database = null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue