Closed Yangff closed 7 years ago
Hi @Yangff,
Yes, you should delete all V8 objects before V8 shutdown. There is a v8pp::class_<T>::destroy(v8::Isolate*)
function to delete all wrapped C++ objects of class T
and its binding in a V8 isolate, and v8pp::cleanup(v8::Isolate*)
function to delete all class bindings in a V8 isolate.
This cleanup function is invoked in a v8pp::context
destructor, but if you do not use v8pp contexts (say in a Node.js addon) you can cleanup v8pp in a node::AtExit()
callback, as in example:
node::AtExit([](void* param) { v8pp::cleanup(static_cast<Isolate*>(param)); }, isolate);
I' upgrading from a old version of v8pp to current so I have this issue.
Finally, I found it is because I didn't set
V8PP_ISOLATE_DATA_SLOT
and it's usingunordered_map
.std::unordered_map<v8::Isolate*, class_singletons> instances
maybe not a good way for store v8 object since it will cleanup by CRT after v8 has been shutdown. For me, it crash while exiting.Maybe these code can be just removed and force to use
V8PP_ISOLATE_DATA_SLOT
?