mirror of
https://github.com/h3poteto/whalebird-desktop
synced 2025-01-27 07:46:15 +01:00
refs #804 Don't send event to webContents when window is already closed (not quit)
This commit is contained in:
parent
fc02edde9f
commit
f1bb90127f
@ -417,7 +417,12 @@ ipcMain.on('start-user-streaming', (event, obj) => {
|
||||
},
|
||||
(err) => {
|
||||
log.error(err)
|
||||
event.sender.send('error-start-user-streaming', err)
|
||||
// In macOS, sometimes window is closed (not quit).
|
||||
// When window is closed, we can not send event to webContents; because it is destroyed.
|
||||
// So we have to guard it.
|
||||
if (!event.sender.isDestroyed()) {
|
||||
event.sender.send('error-start-user-streaming', err)
|
||||
}
|
||||
}
|
||||
)
|
||||
})
|
||||
@ -455,7 +460,9 @@ ipcMain.on('start-directmessages-streaming', (event, obj) => {
|
||||
},
|
||||
(err) => {
|
||||
log.error(err)
|
||||
event.sender.send('error-start-directmessages-streaming', err)
|
||||
if (!event.sender.isDestroyed()) {
|
||||
event.sender.send('error-start-directmessages-streaming', err)
|
||||
}
|
||||
}
|
||||
)
|
||||
})
|
||||
@ -493,7 +500,9 @@ ipcMain.on('start-local-streaming', (event, obj) => {
|
||||
},
|
||||
(err) => {
|
||||
log.error(err)
|
||||
event.sender.send('error-start-local-streaming', err)
|
||||
if (!event.sender.isDestroyed()) {
|
||||
event.sender.send('error-start-local-streaming', err)
|
||||
}
|
||||
}
|
||||
)
|
||||
})
|
||||
@ -531,7 +540,9 @@ ipcMain.on('start-public-streaming', (event, obj) => {
|
||||
},
|
||||
(err) => {
|
||||
log.error(err)
|
||||
event.sender.send('error-start-public-streaming', err)
|
||||
if (!event.sender.isDestroyed()) {
|
||||
event.sender.send('error-start-public-streaming', err)
|
||||
}
|
||||
}
|
||||
)
|
||||
})
|
||||
@ -569,7 +580,9 @@ ipcMain.on('start-list-streaming', (event, obj) => {
|
||||
},
|
||||
(err) => {
|
||||
log.error(err)
|
||||
event.sender.send('error-start-list-streaming', err)
|
||||
if (!event.sender.isDestroyed()) {
|
||||
event.sender.send('error-start-list-streaming', err)
|
||||
}
|
||||
}
|
||||
)
|
||||
})
|
||||
@ -607,7 +620,9 @@ ipcMain.on('start-tag-streaming', (event, obj) => {
|
||||
},
|
||||
(err) => {
|
||||
log.error(err)
|
||||
event.sender.send('error-start-tag-streaming', err)
|
||||
if (!event.sender.isDestroyed()) {
|
||||
event.sender.send('error-start-tag-streaming', err)
|
||||
}
|
||||
}
|
||||
)
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user