Fix a crash when a call ends while you're in it (#10681)

pull/28217/head
Robin 2023-04-21 09:54:27 -04:00 committed by GitHub
parent 83f12fcba0
commit 7c4d0ceddc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View File

@ -773,6 +773,7 @@ export class ElementCall extends Call {
}
public destroy(): void {
ActiveWidgetStore.instance.destroyPersistentWidget(this.widget.id, this.groupCall.room.roomId);
WidgetStore.instance.removeVirtualWidget(this.widget.id, this.groupCall.room.roomId);
this.off(CallEvent.Participants, this.onParticipants);
this.groupCall.off(GroupCallEvent.ParticipantsChanged, this.onGroupCallParticipants);

View File

@ -1050,6 +1050,12 @@ describe("ElementCall", () => {
call.off(CallEvent.Destroy, onDestroy);
});
it("clears widget persistence when destroyed", async () => {
const destroyPersistentWidgetSpy = jest.spyOn(ActiveWidgetStore.instance, "destroyPersistentWidget");
call.destroy();
expect(destroyPersistentWidgetSpy).toHaveBeenCalled();
});
});
describe("instance in a video room", () => {