question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"win" Object passed to "i18next-electron-fs-backend" has been destroyed

See original GitHub issue

Even I change the “close” event handler to:

  win.on('closed', event => {
    event.preventDefault();
  });

The win object still got destroyed, because I can change “activate” handler to this:

app.on('activate', () => {
  if (win.isDestroyed()) {
    createWindow();
  }
});

And it will recreate the window. This means, though win is not null, it is actually destroyed.

And this resulted in the following error:

Uncaught Exception:
Error: Object has been destroyed
    at BrowserWindow.<anonymous> (/xxx/node_modules/i18next-electron-fs-backend/lib/index.js:1:2472)
    at FSReqCallback.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:61:3)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
reZachcommented, Jan 29, 2020

@linonetwo I’ve commented the fix here. The issue has been fixed in the i18next-electron-fs-backend package. You should get version 1.1.2 for the fix and add the code mentioned in the comment.

0reactions
linonetwocommented, Jan 28, 2020

No, I still get Object has been destroyed:

截屏2020-01-28下午1 55 46

I think we can’t prevent win object to be destroyed, we can only try no to use it if it is destroyed.

I’m doing so in IPC related code:

ipcMain.on('start-server', async (event, args) => {
  // prevent "Object has been destroyed" error, after await, win may have destroyed due to close of window
  const reply = (...params) => event.sender.isDestroyed() ? null : event.reply(...params)

// ...
          reply('generate-keys-succeed');
// ...

Maybe you have to check win.isDestroyed() in i18next-electron-fs-backend? So this might still belongs to i18next-electron-fs-backend side.

I guess this only happened in MacOS, where the main process is still running, so i18next-electron-fs-backend still trying to send something to the window, but windows are actually all destroyed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Object has been destroyed · Issue #1 - GitHub
After closing window, and click the tray icon to recreate window, I get following error: Uncaught Exception: Error: Object has been ...
Read more >
"Object has been destroyed" when sending through IPC
The error says that your win object no longer exist, it has been destroyed. The win is reference to new window, it seems...
Read more >
Electron Tutorial: Building Modern Desktop Apps with Vue.js
Learn how to leverage Vue.js and Electron to build and secure modern desktop applications.
Read more >
angular-in-action.pdf
Angular applications are based around components that communicate with one another. You pass data into a child component using inputs and can emit...
Read more >
core-backend Change Log - iTwin.js
Unauthorized open requests should cause a more obvious error. Improved performance logging, especially of IModelDb open operations; ChangeSets are merged one-by ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found