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());
|
log.set("status", this._status.get());
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
log.catch(err);
|
log.catch(err);
|
||||||
|
// free olm Account that might be contained
|
||||||
|
dehydratedDevice?.dispose();
|
||||||
this._error = err;
|
this._error = err;
|
||||||
this._status.set(LoadStatus.Error);
|
this._status.set(LoadStatus.Error);
|
||||||
}
|
}
|
||||||
|
@ -90,11 +90,16 @@ class DehydratedDevice {
|
|||||||
// make it clear that ownership is transfered upon calling this
|
// make it clear that ownership is transfered upon calling this
|
||||||
adoptUnpickledOlmAccount() {
|
adoptUnpickledOlmAccount() {
|
||||||
const account = this._account;
|
const account = this._account;
|
||||||
this._account = null;
|
this._account = undefined;
|
||||||
return account;
|
return account;
|
||||||
}
|
}
|
||||||
|
|
||||||
get deviceId() {
|
get deviceId() {
|
||||||
return this._dehydratedDevice.device_id;
|
return this._dehydratedDevice.device_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dispose() {
|
||||||
|
this._account?.free();
|
||||||
|
this._account = undefined;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user