Skip to content
This repository was archived by the owner on Jun 3, 2021. It is now read-only.

Commit 43f5edb

Browse files
author
qianyuan.wqy
committed
Add clearBFCs method and clear BFCs after self-layout of scroller node.
1 parent 07d2295 commit 43f5edb

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.mm

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,6 +1152,11 @@ - (void)_layoutPlatform
11521152
_flexCssNode->calculateLayout(renderPageSize);
11531153
_flexCssNode->setParent(parent, _flexCssNode);
11541154

1155+
/* We must clear BFCs becuase we have set parent of _flexCSSNode to nullptr and
1156+
manually called its calculateLayout method. This will cause a non-bfc layout node
1157+
to have items in its BFCs vector. Later, a wild pointer may cause crash. */
1158+
_flexCssNode->clearBFCs();
1159+
11551160
// set origin and size back
11561161
_flexCssNode->rewriteLayoutResult(left, top, width, height);
11571162
}

weex_core/Source/core/layout/layout.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -731,6 +731,10 @@ namespace WeexCore {
731731

732732
markDirty();
733733
}
734+
735+
inline void clearBFCs() {
736+
BFCs.clear();
737+
}
734738

735739
inline void addChildAt(WXCoreLayoutNode* const child, Index index) {
736740
mChildList.insert(mChildList.begin() + index, child);

0 commit comments

Comments
 (0)