Skip to content

Commit

Permalink
fix: object has been destroyed
Browse files Browse the repository at this point in the history
receive an error from webContents saying the object has been destroyed when executing the line
win.webContents.off('destroyed', disposable);

we can't unsubscribe once it's already destroyed
  • Loading branch information
benoitf committed Aug 27, 2024
1 parent 125230e commit 547032b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -374,9 +374,9 @@ export default function contextMenu(options = {}) {
const disposeMenu = create(win, options);

const disposable = () => {
win.webContents.off('destroyed', disposable);
disposeMenu();
};
win.webContents.off('destroyed', disposable);

Check failure on line 379 in index.js

View workflow job for this annotation

GitHub Actions / Node.js 20

Expected blank line before this statement.

Check failure on line 379 in index.js

View workflow job for this annotation

GitHub Actions / Node.js 18

Expected blank line before this statement.

if (win.once !== undefined) { // Support for BrowserView
win.webContents.once('destroyed', disposable);
Expand Down

0 comments on commit 547032b

Please sign in to comment.