From 0a289061c752bde3a16359d7658b87cd697f2a7f Mon Sep 17 00:00:00 2001 From: Sergey Date: Wed, 22 Mar 2017 10:58:20 +0400 Subject: [PATCH] fix error when JS exception is thrown inside delphi callback --- src/delphi_intf.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/delphi_intf.cpp b/src/delphi_intf.cpp index 6db04b70ca67b4..1ddea855fb669d 100644 --- a/src/delphi_intf.cpp +++ b/src/delphi_intf.cpp @@ -1938,8 +1938,10 @@ void IFunction::AddArgAsObject(void * value, void * classtype) IValue * IFunction::CallFunction() { v8::Isolate::Scope scope(iso); - if (returnVal) + if (returnVal){ returnVal->Delete(); + returnVal = nullptr; + } auto res = func.Get(iso)->Call(iso->GetCurrentContext(), func.Get(iso), argv.size(), argv.data()); if (!res.IsEmpty()) { returnVal = new IValue(iso, res.ToLocalChecked(), 0);