When a C ++ object that is exposed to v8 is deleted, how can I invalidate descriptors that may point to this object.
I am using v8 as a scripting interface for a larger application. Objects in a larger application are wrapped and accessible in v8 using the node ObjectWrap class.
The problem is that the lifetime of wrapped objects is limited. If in javascript I do something like:
var win = app.getWindow(); win.close();
I want him to act like the comments say. After win.close () (or some other event may be outside of the JS control), any access to win or the duplicated descriptor should fail.
Currently, I have to mark the wrapped C ++ object as invalid and check the validity with every method call. Is this the only way to do this, or is there a way to mark the descriptor as already invalid?
source share