Merged
fix(Fabric): destroy ComponentInstanceProvider on UI thread via custom deleter #3941
xjerwuAdd on 4 days ago
fix(Fabric): destroy ComponentInstanceProvider on UI thread via custom deleter #3941
Merged
Pull Request has been successfully merged by openharmony_ci.
(Thank you for xjerwu's contribution.)4 days ago Added label: bug
4 days ago Added label: AI检视中
xjerwu
4 days ago Comments:
4 days ago Comments:
start build


openharmony_ci
4 days ago Comments:
4 days ago Comments:
该提交没有关联任何Issue,请先关联一个Issue后再触发构建
The PR is not associated with any Issue, Please associate the PR with one Issue before trigger build.


openharmony_ci
4 days ago Comments:
4 days ago Comments:
感谢提交 Pull Requests!
Thanks for submitting a pull request.


4 days ago Added label: dco检查成功
4 days ago Modify description of pull request
4 days ago Removed label: AI检视中
4 days ago Added label: AI已检视
xjerwu
4 days ago Comments:
4 days ago Comments:
start build


openharmony_ci
4 days ago Comments:
4 days ago Comments:
首次触发
门禁构建开始,包含静态检查、代码编译和测试【rnoh_main-test编译, rnoh_main测试, rnoh_main编译】,预计在60分钟内完成,门禁结果会同步发送到注册邮箱。您可以通过如下链接跟踪门禁进展:http://dcp.openharmony.cn/workbench/cicd/detail/6afd1f1964650f998b8d98e3/runlist


4 days ago Added label: 编译成功
4 days ago Added label: 静态检查成功
4 days ago Test passed
openharmony_ci
4 days ago Comments:
4 days ago Comments:
代码门禁通过
您可以通过如下链接查看门禁报告:http://dcp.openharmony.cn/workbench/cicd/detail/6afd1f1964650f998b8d98e3/runlist
静态检查:
| # | check type | result | report |
|---|---|---|---|
| 1 | codeCheck | pass | >>> |
编译测试:
| # | Device | build result | test result | package |
|---|---|---|---|---|
| 1 | rnoh_main | success | success(IGNORE) | >>> |
| 2 | rnoh_main-test | success | NA | >>> |


3 days ago Set haozhihang as approver
3 days ago Approval passed
3 days ago Approval passed
3 days ago Added label: AI检视复核中
3 days ago Reset test status
cpf-manager
3 days ago Comments:
3 days ago Comments:
3 days ago Test passed
3 days ago Removed label: AI检视复核中
3 days ago Added label: AI检视复核通过
3 days ago Closed associated issue
3 days ago Merged pull request, merge node SHA: 9b76f59dd5e810444f98b0be89895ef5c630c280
3 days ago Merged pull request, merge node SHA: 9b76f59dd5e810444f98b0be89895ef5c630c280
Change Type
Check the corresponding type (
√), only one may be selected:Change Scope
Change Description
ComponentInstanceProvidershared_ptrso the finaldeleteruns on the UI (MAIN) thread — directly if already on MAIN, otherwise posted to MAIN.ComponentInstanceProvider(the preallocation delegate) can be destroyed on an ffrt worker thread when the preallocation-parallelization lambda inComponentInstancePreallocationRequestQueue::pushdrops the last strong reference at the end of the lambda. This cascades into~TextComponentInstanceon a non-UI thread, wheredisposeTextStorage()→resetTextContentWithStyledString()→NodeApi::resetAttribute()→maybeThrowcalls an ArkUI attribute API off the UI thread, gets a non-zero status, throwsstd::runtime_error, and escapes the implicitnoexceptdestructor →std::terminate()crash. The existingtry/catcharoundprocessPreallocationRequestcannot intercept this (destruction happens at lambda scope exit, outside the try, and destructors arenoexcept).shared_ptr<ComponentInstanceProvider>: when the last strong reference is released, if already on the UI thread,delete pdirectly; otherwise postdelete ptoTaskThread::MAIN. The inner posted lambda capturestaskExecutor(strong ref) soTaskExecutorstays alive until the task completes, even after the control block releases the outer strong ref.~ComponentInstanceProviderand the component instances it owns now always run on the UI thread, so ArkUI attribute calls are made on the correct thread.ComponentInstanceProvider; no public API change; no business-logic impact.RNOH Special Notes
Native layer change notes:
libhermes.sosymbols unchanged; no.soimpact. The change only affects where~ComponentInstanceProvider(and thus ArkUI node cleanup via~ArkUINode::disposeNode) runs, forcing it onto the UI thread.Linked Issue
Linked #3594.
Testing
Checklist