Hi,
<https://stackoverflow.com/posts/68600983/timeline>

I'm attempting to rerun a V8 script in a given context/scope, but I'm 
getting a segmentation fault. If I compile other scripts and run in 
succession it works.
int loadScript(const char * scriptCode) { v8::Local<v8::String> source = 
v8::String::NewFromUtf8(isolate, scriptCode, v8::NewStringType::kNormal) 
.ToLocalChecked(); // Compile the source code. script = 
v8::Script::Compile(context, source).ToLocalChecked(); return 0; } 
std::string executeScript() { // Run the script to get the result. 
v8::Local<v8::Value> result = script->Run(context).ToLocalChecked(); // 
Convert the result to an UTF8 string and print it. v8::String::Utf8Value 
utf8(isolate, result); return std::string(*utf8); } 

////
sv8i.loadScript("let a = 1; \ let b = 2; \ JSON.stringify({a, b}); \ "); 
printf("%s\n", sv8i.executeScript().c_str()); printf("%s\n", 
sv8i.executeScript().c_str()); // Seg fault 

Why?


-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/v8-users/7f9eebdc-ecf3-4fe6-9c3c-98e26a765014n%40googlegroups.com.

Reply via email to