Skip to content

Commit

Permalink
Merge pull request atom#23132 from icecream17/patch-9
Browse files Browse the repository at this point in the history
Change from `crashed` to `render-process-gone`
  • Loading branch information
sadick254 authored Oct 25, 2021
2 parents fd55779 + f71be55 commit 00b34d6
Showing 1 changed file with 29 additions and 24 deletions.
53 changes: 29 additions & 24 deletions src/main-process/atom-window.js
Original file line number Diff line number Diff line change
@@ -236,32 +236,37 @@ 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;
}

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'
});
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;
}

switch (result.response) {
case 0:
this.browserWindow.destroy();
break;
case 1:
this.browserWindow.reload();
break;
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'
});

switch (result.response) {
case 0:
this.browserWindow.destroy();
break;
case 1:
this.browserWindow.reload();
break;
}
}
}
});
);

this.browserWindow.webContents.on('will-navigate', (event, url) => {
if (url !== this.browserWindow.webContents.getURL())

0 comments on commit 00b34d6

Please sign in to comment.