mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 03:25:12 +01:00
dispose attachment blobs when pending event is removed/closing session
This commit is contained in:
parent
f6dbb23f79
commit
fba5877b3b
@ -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 New Issue
Block a user