Exception of new object in multithreading
pony5551 opened this issue · 9 comments
I can confirm an access violation. Thanks for finding this, I'll post a new issue with a MCVE as there's too much unrelated code in your example. The issue can be reproduced regardless of multi-threading.
BTW this code is wrong:
RegisterMethod(AInstance, 'free', @TConsole.Free);
Any method you wish to register as a native callback must have the specific signature:
function(Args: PJsValueRef; ArgCount: Word): JsValueRef of object;
(as shown in the TConsole
example).
I should probably make it clear in a comment or wiki.
Sorry, I used it wrong
RegisterMethod (AInstance, 'free' @ TConsole. Free);
Sorry, I used it wrong
RegisterMethod (AInstance, 'free' @ TConsole. Free);
No problem, and thanks for reporting.
Constructors of projected classes must be addref-ed to prevent them from being garbage-collected.
Thank you for finding and reporting it.
See TestFinalizer4 for a minimal example to reproduce the problem: simply call the script in a loop long enough until GC releases the constructor - . The next attempt to call the constructor will cause an access violation.
You may have to submit an issue to chakracore using c++
Sorry for being unclear. The issue was on the chakracore-delphi side (Pascal), and it's fixed now.
I see!thank you!
Welcome and thank you for your help.