8000 Attempting to close window immediately after "did-fail-load" crashes Electron · Issue #8930 · electron/electron · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Attempting to close window immediately after "did-fail-load" crashes Electron #8930
Closed
@felixrieseberg

Description

@felixrieseberg

Attempting to close a window immediately after receiving a did-fail-load event crashes Electron. There's an easy workaround (delaying the close operation in a setTimeout fixes the crash).

I created a minimal repro, but for clarity, here's what's happening:

app.on('ready', () => {
  const win = new BrowserWindow({})

  win.webContents.on('did-fail-load', () => {
    win.close()

    // If you call this instead, we'll be alright - and the
    // interval below will prove it
    // setTimeout(() => win.close(), 1000)
  })

  win.loadURL('https://i-do-not-exist')
})

app.on('window-all-closed', () => {
  setInterval(() => console.log('Still alive!'), 500)
  console.log(`If you're not seeing a "still alive" printed, we're dead :(`)
})
  • Electron version: 1.6.1, 1.6.2 and later
  • Operating system: proven on macOS, reports from Windows

Expected behavior

Electron should not crash

Actual behavior

Electron crashes

How to reproduce

git clone https://github.com/felixrieseberg/electron-close-crash
npm install
npm start

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0