prevent double free on olm account when logging out
by ensuring we only dispose the e2ee/Account once, as well as the Session and other classes
This commit is contained in:
parent
3ef37c15c7
commit
bef12c7a8f
4 changed files with 10 additions and 0 deletions
|
@ -374,12 +374,17 @@ export class Session {
|
||||||
|
|
||||||
dispose() {
|
dispose() {
|
||||||
this._olmWorker?.dispose();
|
this._olmWorker?.dispose();
|
||||||
|
this._olmWorker = undefined;
|
||||||
this._sessionBackup?.dispose();
|
this._sessionBackup?.dispose();
|
||||||
|
this._sessionBackup = undefined;
|
||||||
this._megolmDecryption.dispose();
|
this._megolmDecryption.dispose();
|
||||||
|
this._megolmDecryption = undefined;
|
||||||
this._e2eeAccount?.dispose();
|
this._e2eeAccount?.dispose();
|
||||||
|
this._e2eeAccount = undefined;
|
||||||
for (const room of this._rooms.values()) {
|
for (const room of this._rooms.values()) {
|
||||||
room.dispose();
|
room.dispose();
|
||||||
}
|
}
|
||||||
|
this._rooms = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -384,12 +384,15 @@ export class SessionContainer {
|
||||||
this._reconnector = null;
|
this._reconnector = null;
|
||||||
if (this._requestScheduler) {
|
if (this._requestScheduler) {
|
||||||
this._requestScheduler.stop();
|
this._requestScheduler.stop();
|
||||||
|
this._requestScheduler = null;
|
||||||
}
|
}
|
||||||
if (this._sync) {
|
if (this._sync) {
|
||||||
this._sync.stop();
|
this._sync.stop();
|
||||||
|
this._sync = null;
|
||||||
}
|
}
|
||||||
if (this._session) {
|
if (this._session) {
|
||||||
this._session.dispose();
|
this._session.dispose();
|
||||||
|
this._session = null;
|
||||||
}
|
}
|
||||||
if (this._waitForFirstSyncHandle) {
|
if (this._waitForFirstSyncHandle) {
|
||||||
this._waitForFirstSyncHandle.dispose();
|
this._waitForFirstSyncHandle.dispose();
|
||||||
|
|
|
@ -311,5 +311,6 @@ export class Account {
|
||||||
|
|
||||||
dispose() {
|
dispose() {
|
||||||
this._account.free();
|
this._account.free();
|
||||||
|
this._account = undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -212,6 +212,7 @@ class KeyOperation {
|
||||||
|
|
||||||
dispose() {
|
dispose() {
|
||||||
this.session.free();
|
this.session.free();
|
||||||
|
this.session = undefined as any;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** returns whether the key for this operation has been checked at some point against storage
|
/** returns whether the key for this operation has been checked at some point against storage
|
||||||
|
|
Reference in a new issue