Skip to content

"Class property and descriptor" example crashes in Electron render process on reload #1011

@ToadKing

Description

@ToadKing

PoC Project: https://github.com/ToadKing/electron-native-module-poc (The native module part is an exact copy of the example in the node-addon-api docs.)

The class example in the docs makes the constructor reference persistent using Napi::Persistent on module initialization. However, in Electron when a render process reloads a page, the native module is re-initialized without reloading the shared library itself. When a new constructor reference is loaded into the constructor variable it tries to delete the former reference, which causes a crash of the Electron render process.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions