forked from mystiq/hydrogen-web
dispose attachment blobs when pending event is removed/closing session
This commit is contained in:
parent
f6dbb23f79
commit
fba5877b3b
4 changed files with 22 additions and 0 deletions
|
@ -89,6 +89,11 @@ export class AttachmentUpload {
|
||||||
setPath(`${prefix}url`, content, this._mxcUrl);
|
setPath(`${prefix}url`, content, this._mxcUrl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dispose() {
|
||||||
|
this._unencryptedBlob.dispose();
|
||||||
|
this._transferredBlob.dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function setPath(path, content, value) {
|
function setPath(path, content, value) {
|
||||||
|
|
|
@ -640,6 +640,7 @@ export class Room extends EventEmitter {
|
||||||
dispose() {
|
dispose() {
|
||||||
this._roomEncryption?.dispose();
|
this._roomEncryption?.dispose();
|
||||||
this._timeline?.dispose();
|
this._timeline?.dispose();
|
||||||
|
this._sendQueue.dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -152,4 +152,12 @@ export class PendingEvent {
|
||||||
this._status = SendStatus.Sent;
|
this._status = SendStatus.Sent;
|
||||||
this._emitUpdate("status");
|
this._emitUpdate("status");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dispose() {
|
||||||
|
if (this._attachments) {
|
||||||
|
for (const attachment of Object.values(this._attachments)) {
|
||||||
|
attachment.dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,6 +121,7 @@ export class SendQueue {
|
||||||
await txn.complete();
|
await txn.complete();
|
||||||
this._pendingEvents.remove(idx);
|
this._pendingEvents.remove(idx);
|
||||||
}
|
}
|
||||||
|
pendingEvent.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
emitRemovals(pendingEvents) {
|
emitRemovals(pendingEvents) {
|
||||||
|
@ -129,6 +130,7 @@ export class SendQueue {
|
||||||
if (idx !== -1) {
|
if (idx !== -1) {
|
||||||
this._pendingEvents.remove(idx);
|
this._pendingEvents.remove(idx);
|
||||||
}
|
}
|
||||||
|
pendingEvent.dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,4 +203,10 @@ export class SendQueue {
|
||||||
await txn.complete();
|
await txn.complete();
|
||||||
return pendingEvent;
|
return pendingEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dispose() {
|
||||||
|
for (const pe in this._pendingEvents.array) {
|
||||||
|
pe.dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue