diff --git a/src/matrix/Session.js b/src/matrix/Session.js index 90f383bb..13dbc128 100644 --- a/src/matrix/Session.js +++ b/src/matrix/Session.js @@ -374,12 +374,17 @@ export class Session { dispose() { this._olmWorker?.dispose(); + this._olmWorker = undefined; this._sessionBackup?.dispose(); + this._sessionBackup = undefined; this._megolmDecryption.dispose(); + this._megolmDecryption = undefined; this._e2eeAccount?.dispose(); + this._e2eeAccount = undefined; for (const room of this._rooms.values()) { room.dispose(); } + this._rooms = undefined; } /** diff --git a/src/matrix/SessionContainer.js b/src/matrix/SessionContainer.js index 84d79bcb..9794e93a 100644 --- a/src/matrix/SessionContainer.js +++ b/src/matrix/SessionContainer.js @@ -384,12 +384,15 @@ export class SessionContainer { this._reconnector = null; if (this._requestScheduler) { this._requestScheduler.stop(); + this._requestScheduler = null; } if (this._sync) { this._sync.stop(); + this._sync = null; } if (this._session) { this._session.dispose(); + this._session = null; } if (this._waitForFirstSyncHandle) { this._waitForFirstSyncHandle.dispose(); diff --git a/src/matrix/e2ee/Account.js b/src/matrix/e2ee/Account.js index 81725dcc..13792ddc 100644 --- a/src/matrix/e2ee/Account.js +++ b/src/matrix/e2ee/Account.js @@ -311,5 +311,6 @@ export class Account { dispose() { this._account.free(); + this._account = undefined; } } diff --git a/src/matrix/e2ee/megolm/decryption/KeyLoader.ts b/src/matrix/e2ee/megolm/decryption/KeyLoader.ts index 58f968c8..3aca957d 100644 --- a/src/matrix/e2ee/megolm/decryption/KeyLoader.ts +++ b/src/matrix/e2ee/megolm/decryption/KeyLoader.ts @@ -212,6 +212,7 @@ class KeyOperation { dispose() { this.session.free(); + this.session = undefined as any; } /** returns whether the key for this operation has been checked at some point against storage