提交 f6b28f28 编写于 作者: O openharmony_ci 提交者: Gitee

!203 GetOrigRect函数调用会出现空指针异常

Merge pull request !203 from wangtiantian/bug_master3
......@@ -35,7 +35,10 @@ UIViewGroup::UIViewGroup()
#endif
}
UIViewGroup::~UIViewGroup() {}
UIViewGroup::~UIViewGroup()
{
RemoveAllChildren();
}
void UIViewGroup::Add(UIView* view)
{
......@@ -143,17 +146,7 @@ void UIViewGroup::Remove(UIView* view)
void UIViewGroup::RemoveAll()
{
UIView* node = childrenHead_;
childrenHead_ = nullptr;
childrenTail_ = nullptr;
childrenNum_ = 0;
UIView* tmp = nullptr;
while (node != nullptr) {
tmp = node;
node = node->GetNextSibling();
tmp->SetParent(nullptr);
tmp->SetNextSibling(nullptr);
}
RemoveAllChildren();
OnChildChanged();
}
......@@ -298,4 +291,19 @@ void UIViewGroup::AutoResize()
SetWidth(rect.GetWidth() + rect.GetLeft());
SetHeight(rect.GetHeight() + rect.GetTop());
}
void UIViewGroup::RemoveAllChildren()
{
UIView* node = childrenHead_;
childrenHead_ = nullptr;
childrenTail_ = nullptr;
childrenNum_ = 0;
UIView* tmp = nullptr;
while (node != nullptr) {
tmp = node;
node = node->GetNextSibling();
tmp->SetParent(nullptr);
tmp->SetNextSibling(nullptr);
}
}
} // namespace OHOS
......@@ -286,6 +286,7 @@ protected:
private:
void AutoResize();
void RemoveAllChildren();
#if ENABLE_FOCUS_MANAGER
bool isInterceptFocus_ : 1;
#endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册