!810 Fix static variable multithreading issue

Merge pull request !810 from bigtea/master
This commit is contained in:
openharmony_ci 2024-08-15 16:17:31 +00:00 committed by Gitee
commit 984872353c
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 3 additions and 2 deletions

View File

@ -83,8 +83,7 @@ void JSPtHooks::LoadModule(std::string_view pandaFileName, std::string_view entr
[[maybe_unused]] LocalScope scope(debugger_->vm_);
static uint32_t scriptId = 0;
if (debugger_->NotifyScriptParsed(scriptId++, pandaFileName.data(), entryPoint)) {
if (debugger_->NotifyScriptParsed(g_scriptId++, pandaFileName.data(), entryPoint)) {
firstTime_ = true;
}
}

View File

@ -25,6 +25,8 @@
namespace panda::ecmascript::tooling {
class DebuggerImpl;
static std::atomic<uint32_t> g_scriptId {0};
class JSPtHooks : public PtHooks {
public:
explicit JSPtHooks(DebuggerImpl *debugger) : debugger_(debugger) {}