mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-09-19 15:08:08 +03:00
change to render-process-gone
`crashed` is deprecated. https://github.com/electron/electron/blob/9-x-y/docs/api/web-contents.md Note: The previous code shows the error dialog on both the "killed" and "crashed" events. But now it's only "crashed"
This commit is contained in:
parent
f5a1adc71b
commit
5238a022e0
@ -236,30 +236,32 @@ module.exports = class AtomWindow extends EventEmitter {
|
||||
if (result.response === 0) this.browserWindow.destroy();
|
||||
});
|
||||
|
||||
this.browserWindow.webContents.on('crashed', async () => {
|
||||
if (this.headless) {
|
||||
console.log('Renderer process crashed, exiting');
|
||||
this.atomApplication.exit(100);
|
||||
return;
|
||||
}
|
||||
this.browserWindow.webContents.on('render-process-gone', async (event, { reason }) => {
|
||||
if (reason === "crashed") {
|
||||
if (this.headless) {
|
||||
console.log('Renderer process crashed, exiting');
|
||||
this.atomApplication.exit(100);
|
||||
return;
|
||||
}
|
||||
|
||||
await this.fileRecoveryService.didCrashWindow(this);
|
||||
await this.fileRecoveryService.didCrashWindow(this);
|
||||
|
||||
const result = await dialog.showMessageBox(this.browserWindow, {
|
||||
type: 'warning',
|
||||
buttons: ['Close Window', 'Reload', 'Keep It Open'],
|
||||
cancelId: 2, // Canceling should be the least destructive action
|
||||
message: 'The editor has crashed',
|
||||
detail: 'Please report this issue to https://github.com/atom/atom'
|
||||
});
|
||||
const result = await dialog.showMessageBox(this.browserWindow, {
|
||||
type: 'warning',
|
||||
buttons: ['Close Window', 'Reload', 'Keep It Open'],
|
||||
cancelId: 2, // Canceling should be the least destructive action
|
||||
message: 'The editor has crashed',
|
||||
detail: 'Please report this issue to https://github.com/atom/atom'
|
||||
});
|
||||
|
||||
switch (result.response) {
|
||||
case 0:
|
||||
this.browserWindow.destroy();
|
||||
break;
|
||||
case 1:
|
||||
this.browserWindow.reload();
|
||||
break;
|
||||
switch (result.response) {
|
||||
case 0:
|
||||
this.browserWindow.destroy();
|
||||
break;
|
||||
case 1:
|
||||
this.browserWindow.reload();
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user