1
0
mirror of https://github.com/h3poteto/whalebird-desktop synced 2025-01-29 00:29:46 +01:00

refs #804 Don't send event to webContents when window is already closed (not quit)

This commit is contained in:
AkiraFukushima 2018-12-24 18:05:28 +09:00
parent fc02edde9f
commit f1bb90127f

View File

@ -417,8 +417,13 @@ ipcMain.on('start-user-streaming', (event, obj) => {
},
(err) => {
log.error(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,8 +460,10 @@ ipcMain.on('start-directmessages-streaming', (event, obj) => {
},
(err) => {
log.error(err)
if (!event.sender.isDestroyed()) {
event.sender.send('error-start-directmessages-streaming', err)
}
}
)
})
})
@ -493,8 +500,10 @@ ipcMain.on('start-local-streaming', (event, obj) => {
},
(err) => {
log.error(err)
if (!event.sender.isDestroyed()) {
event.sender.send('error-start-local-streaming', err)
}
}
)
})
})
@ -531,8 +540,10 @@ ipcMain.on('start-public-streaming', (event, obj) => {
},
(err) => {
log.error(err)
if (!event.sender.isDestroyed()) {
event.sender.send('error-start-public-streaming', err)
}
}
)
})
})
@ -569,8 +580,10 @@ ipcMain.on('start-list-streaming', (event, obj) => {
},
(err) => {
log.error(err)
if (!event.sender.isDestroyed()) {
event.sender.send('error-start-list-streaming', err)
}
}
)
})
})
@ -607,8 +620,10 @@ ipcMain.on('start-tag-streaming', (event, obj) => {
},
(err) => {
log.error(err)
if (!event.sender.isDestroyed()) {
event.sender.send('error-start-tag-streaming', err)
}
}
)
})
})