This is an automated email from the ASF dual-hosted git repository. moshen pushed a commit to branch fix-rtl-crash in repository https://gitbox.apache.org/repos/asf/incubator-weex.git
commit 43f5edb6f8daece2797adc10947e19844dfa14ba Author: qianyuan.wqy <[email protected]> AuthorDate: Wed Oct 9 11:05:13 2019 +0800 Add clearBFCs method and clear BFCs after self-layout of scroller node. --- ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.mm | 5 +++++ weex_core/Source/core/layout/layout.h | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.mm b/ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.mm index 4d3f4c9..981a7af 100644 --- a/ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.mm +++ b/ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.mm @@ -1152,6 +1152,11 @@ WX_EXPORT_METHOD(@selector(resetLoadmore)) _flexCssNode->calculateLayout(renderPageSize); _flexCssNode->setParent(parent, _flexCssNode); + /* We must clear BFCs becuase we have set parent of _flexCSSNode to nullptr and + manually called its calculateLayout method. This will cause a non-bfc layout node + to have items in its BFCs vector. Later, a wild pointer may cause crash. */ + _flexCssNode->clearBFCs(); + // set origin and size back _flexCssNode->rewriteLayoutResult(left, top, width, height); } diff --git a/weex_core/Source/core/layout/layout.h b/weex_core/Source/core/layout/layout.h index 6217972..e8d58f7 100644 --- a/weex_core/Source/core/layout/layout.h +++ b/weex_core/Source/core/layout/layout.h @@ -731,6 +731,10 @@ namespace WeexCore { markDirty(); } + + inline void clearBFCs() { + BFCs.clear(); + } inline void addChildAt(WXCoreLayoutNode* const child, Index index) { mChildList.insert(mChildList.begin() + index, child);
