!2976 修复【OpenHarmony 3.2.8.2】【低概率-1次/12h】xts libark_jsruntime.so 出现cppcrash

Merge pull request !2976 from 任堂宇/master
This commit is contained in:
openharmony_ci 2022-11-19 08:33:40 +00:00 committed by Gitee
commit c334cc5f9c
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -416,9 +416,9 @@ public:
{
os::memory::LockHolder lock(mutex_);
auto thread = workerVm->GetJSThread();
if (thread != nullptr) {
if (thread != nullptr && hostVm != nullptr) {
auto tid = thread->GetThreadId();
if (tid != 0 && hostVm != nullptr && workerVm != nullptr) {
if (tid != 0) {
WorkerList_.emplace(tid, workerVm);
}
}
@ -439,9 +439,12 @@ public:
bool DeleteWorker(EcmaVM *hostVm, EcmaVM *workerVm)
{
os::memory::LockHolder lock(mutex_);
if (hostVm != nullptr && workerVm != nullptr) {
auto tid = workerVm->GetJSThread()->GetThreadId();
if (tid == 0) {return false;}
auto thread = workerVm->GetJSThread();
if (hostVm != nullptr && thread != nullptr) {
auto tid = thread->GetThreadId();
if (tid == 0) {
return false;
}
auto iter = WorkerList_.find(tid);
if (iter != WorkerList_.end()) {
WorkerList_.erase(iter);