add dispose to room encryption
This commit is contained in:
parent
6c46cc98de
commit
ed913ca24b
4 changed files with 15 additions and 2 deletions
|
@ -80,7 +80,7 @@ export class SessionLoadViewModel extends ViewModel {
|
|||
async cancel() {
|
||||
try {
|
||||
if (this._sessionContainer) {
|
||||
this._sessionContainer.stop();
|
||||
this._sessionContainer.dispose();
|
||||
if (this._deleteSessionOnCancel) {
|
||||
await this._sessionContainer.deleteSession();
|
||||
}
|
||||
|
|
|
@ -269,10 +269,13 @@ export class Session {
|
|||
return this._sendScheduler.isStarted;
|
||||
}
|
||||
|
||||
stop() {
|
||||
dispose() {
|
||||
this._olmWorker?.dispose();
|
||||
this._sendScheduler.stop();
|
||||
this._sessionBackup?.dispose();
|
||||
for (const room of this._rooms.values()) {
|
||||
room.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
async start(lastVersionResponse) {
|
||||
|
|
|
@ -39,6 +39,7 @@ export class RoomEncryption {
|
|||
this._storage = storage;
|
||||
this._sessionBackup = sessionBackup;
|
||||
this._notifyMissingMegolmSession = notifyMissingMegolmSession;
|
||||
this._disposed = false;
|
||||
}
|
||||
|
||||
async enableSessionBackup(sessionBackup) {
|
||||
|
@ -322,6 +323,10 @@ export class RoomEncryption {
|
|||
const txnId = makeTxnId();
|
||||
await hsApi.sendToDevice(type, payload, txnId).response();
|
||||
}
|
||||
|
||||
dispose() {
|
||||
this._disposed = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -529,6 +529,11 @@ export class Room extends EventEmitter {
|
|||
applyIsTrackingMembersChanges(changes) {
|
||||
this._summary.applyChanges(changes);
|
||||
}
|
||||
|
||||
dispose() {
|
||||
this._roomEncryption?.dispose();
|
||||
this._timeline?.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
class DecryptionRequest {
|
||||
|
|
Reference in a new issue