mirror of
https://github.com/ThaUnknown/miru.git
synced 2026-04-20 12:32:03 +00:00
fix: prevent crash loops
This commit is contained in:
parent
d123cdfbbb
commit
998cc14c15
2 changed files with 9 additions and 4 deletions
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "Miru",
|
||||
"version": "3.0.0",
|
||||
"version": "3.0.1",
|
||||
"author": "ThaUnknown_ <ThaUnknown@users.noreply.github.com>",
|
||||
"main": "src/index.js",
|
||||
"homepage": "https://github.com/ThaUnknown/miru#readme",
|
||||
|
|
|
|||
11
src/index.js
11
src/index.js
|
|
@ -1,4 +1,4 @@
|
|||
const { app, BrowserWindow, protocol, shell, ipcMain } = require('electron')
|
||||
const { app, BrowserWindow, protocol, shell, ipcMain, dialog } = require('electron')
|
||||
const path = require('path')
|
||||
require('./main/misc.js')
|
||||
|
||||
|
|
@ -137,10 +137,15 @@ function createWindow () {
|
|||
mainWindow = null
|
||||
})
|
||||
|
||||
let crashcount = 0
|
||||
mainWindow.webContents.on('render-process-gone', (e, { reason }) => {
|
||||
if (reason === 'crashed') {
|
||||
app.relaunch()
|
||||
app.quit()
|
||||
if (++crashcount > 10) {
|
||||
dialog.showMessageBox({ message: 'Crashed too many times.', title: 'Miru', detail: 'App crashed too many times. For a fix visit https://github.com/ThaUnknown/miru/blob/master/docs/faq.md#miru-crashed-too-many-times', icon: '/renderer/public/logo.ico' })
|
||||
} else {
|
||||
app.relaunch()
|
||||
app.quit()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue