mirror of
https://github.com/Zagrios/bs-manager.git
synced 2026-07-03 14:08:25 +02:00
[bugfix] Error when closing oneclick download window while still downloading
stop send data after the window is destroyed + unsubscribe observable when the window closes
This commit is contained in:
@@ -39,6 +39,7 @@ export class IpcService {
|
||||
}
|
||||
|
||||
public send<T>(channel: string, window: BrowserWindow, response?: T | Error): void {
|
||||
if(window.webContents?.isDestroyed()){ return; }
|
||||
window.webContents?.send(channel, response);
|
||||
}
|
||||
|
||||
@@ -53,6 +54,7 @@ export class IpcService {
|
||||
complete: () => this.send(this.getCompleteChannel(channel), window)
|
||||
})
|
||||
|
||||
window.webContents.once("destroyed", () => sub.unsubscribe());
|
||||
window.webContents.ipc.once(this.getTearDownChannel(channel), () => sub.unsubscribe());
|
||||
|
||||
sub.add(() => {
|
||||
|
||||
Reference in New Issue
Block a user