You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Calling class_::reference_external "does not take ownership of the C++ pointer", but v8pp still deletes the C++ object when class_::destroy is called, which is clearly not intended and leads to crashes due to double deletion.
The "destroy_after" parameter of class_singleton::wrap is only used to determine what callback is given to SetWeak, and isn't stored anywhere in the actual object registry, and so v8pp isn't actually keeping the necessary ownership information everywhere it needs to.
This affects both the shared_ptr branch and the main branch.
The text was updated successfully, but these errors were encountered:
I've fixed this issue by marking persistent handles for externally referenced objects as independent,
and do not call destroy function for such objects.
`MarkIndependent()` in persistent handle class has been deprecated since recent
V8 versions (ca. >= 6.0), so `IsIndependent()` returns always true.
This deprecation breaks the mechanism of marking externally referecned wrapped
C++ object those shall not be deleted.
To fix it, an additional internal `v8::Object` field has been added
(total fields count becomes 3) to store a pointer to a wrapped object
destructor function. Such an internal pointer field must be aligned by 2, but
unfortunately, Visual C++ can generates an unaligned pointer to destroy function.
At the current time the single destructor function per wrapped class is stored
in the `object_registry`, so thar 3rd internal fields in a wrapped object is
used as a simple marker wether to call the object destructor or not.
Calling class_::reference_external "does not take ownership of the C++ pointer", but v8pp still deletes the C++ object when class_::destroy is called, which is clearly not intended and leads to crashes due to double deletion.
The "destroy_after" parameter of class_singleton::wrap is only used to determine what callback is given to SetWeak, and isn't stored anywhere in the actual object registry, and so v8pp isn't actually keeping the necessary ownership information everywhere it needs to.
This affects both the shared_ptr branch and the main branch.
The text was updated successfully, but these errors were encountered: