!1537 修复清理napI引用,导致的崩溃问题

Merge pull request !1537 from taojuncun/bug_1113_02
This commit is contained in:
openharmony_ci 2024-11-13 10:05:55 +00:00 committed by Gitee
commit 865510a712
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -662,7 +662,6 @@ void NAccessibilityConfigObserverImpl::UnsubscribeObserver(napi_env env,
for (auto iter = observers_.begin(); iter != observers_.end();) {
if ((*iter)->configId_ == id) {
if (CheckObserverEqual(env, observer, (*iter)->env_, (*iter)->handlerRef_)) {
napi_delete_reference((*iter)->env_, (*iter)->handlerRef_);
observers_.erase(iter);
return;
} else {
@ -680,7 +679,6 @@ void NAccessibilityConfigObserverImpl::UnsubscribeObservers(OHOS::AccessibilityC
std::lock_guard<ffrt::mutex> lock(mutex_);
for (auto iter = observers_.begin(); iter != observers_.end();) {
if ((*iter)->configId_ == id) {
napi_delete_reference((*iter)->env_, (*iter)->handlerRef_);
iter = observers_.erase(iter);
} else {
iter++;