mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2025-01-11 04:27:40 +01:00
ensure olm Account in dehydrated device is freed on error
This commit is contained in:
parent
bef12c7a8f
commit
544019f67d
@ -189,6 +189,8 @@ export class SessionContainer {
|
||||
log.set("status", this._status.get());
|
||||
} catch (err) {
|
||||
log.catch(err);
|
||||
// free olm Account that might be contained
|
||||
dehydratedDevice?.dispose();
|
||||
this._error = err;
|
||||
this._status.set(LoadStatus.Error);
|
||||
}
|
||||
|
@ -90,11 +90,16 @@ class DehydratedDevice {
|
||||
// make it clear that ownership is transfered upon calling this
|
||||
adoptUnpickledOlmAccount() {
|
||||
const account = this._account;
|
||||
this._account = null;
|
||||
this._account = undefined;
|
||||
return account;
|
||||
}
|
||||
|
||||
get deviceId() {
|
||||
return this._dehydratedDevice.device_id;
|
||||
}
|
||||
|
||||
dispose() {
|
||||
this._account?.free();
|
||||
this._account = undefined;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user