node::ObjectWrap dispose method
https://github.com/nodejs/node/issues/22996
There is an allocated object inside of class constructor. https://github.com/tugrul/cryptian/blob/master/addon/src/node/algorithm.h#L29 and https://github.com/tugrul/cryptian/blob/master/addon/src/node/mode.h#L40.
I can't use destructor method because node::ObjectWrap have destructor method.
I think node::ObjectWrap can have Dispose placeholder method then call Dispose method by own destructor. By the way subclass of node::ObjectWrap can override Dispose method and able to free own allocated objects.
Is there an another way to free allocated objects by subclass of node::ObjectWrap ?
I'm not sure that I'm following your problem.
Why don't you think you can add a destructor for your class inheriting from node::ObjectWrap? Just that is surely illustrated in the Doc's example in wrapping C/C++ objects here. Afterall, C++ is going to take care of chaining the destructor calls along the inheritance chain.
Thereafter, are you trying to propose that Dispose is added on the node::ObjectWrap interface? Its unclear to me that its needed (because of destructor chaining).
I really don't think we need another way!
Lastly, given you're making use of NAN in your code, would you not be better inheriting from Nan::ObjectWrap? ( https://github.com/nodejs/nan/blob/master/doc/object_wrappers.md )
Thank you.
Before I tried add destructor my class and there was a warning messages "like non-virtual destructor have undefined behavior".
I tried again and i found missing destructor of my initialization object's class. I put virtual destructor placeholders and it solved that warning message.
https://github.com/tugrul/cryptian/commit/1e433038a8c2ac2eae3d3d5c9508ca91c40ee1a8