mirror of
https://github.com/openharmony/ace_ace_engine.git
synced 2026-07-20 15:14:04 -04:00
fix pcPreview select popup crash bug
Signed-off-by: lihao <lihao71@huawei.com> Change-Id: I8213e2e475bf97e9529966dcebe0f3480c80aade
This commit is contained in:
@@ -280,6 +280,7 @@ void QJSDeclarativeEngine::ReplaceJSContent(const std::string& url, const std::s
|
||||
#endif
|
||||
RefPtr<Component> QJSDeclarativeEngine::GetNewComponentWithJsCode(const std::string& jsCode)
|
||||
{
|
||||
ViewStackProcessor::GetInstance()->ClearStack();
|
||||
bool result = engineInstance_->InitAceModules(jsCode.c_str(), jsCode.length(), "AddComponent");
|
||||
if (!result) {
|
||||
LOGE("execute addComponent failed,script=[%{public}s]", jsCode.c_str());
|
||||
|
||||
@@ -169,6 +169,12 @@ public:
|
||||
visualState_ = VisualState::NOTSET;
|
||||
}
|
||||
|
||||
void ClearStack()
|
||||
{
|
||||
auto emptyStack = std::stack<std::unordered_map<std::string, RefPtr<Component>>>();
|
||||
componentsStack_.swap(emptyStack);
|
||||
}
|
||||
|
||||
private:
|
||||
ViewStackProcessor();
|
||||
|
||||
|
||||
@@ -100,12 +100,14 @@ void SelectPopupComponent::InnerHideDialog(uint32_t index)
|
||||
}
|
||||
|
||||
#if defined(WINDOWS_PLATFORM) || defined(MAC_PLATFORM)
|
||||
auto parentNode = node_->GetParentNode();
|
||||
if (parentNode) {
|
||||
parentNode->SetLeft(0);
|
||||
parentNode->SetTop(0);
|
||||
parentNode->SetWidth(0);
|
||||
parentNode->SetHeight(0);
|
||||
if (node_) {
|
||||
auto parentNode = node_->GetParentNode();
|
||||
if (parentNode) {
|
||||
parentNode->SetLeft(0);
|
||||
parentNode->SetTop(0);
|
||||
parentNode->SetWidth(0);
|
||||
parentNode->SetHeight(0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
auto manager = manager_.Upgrade();
|
||||
|
||||
Reference in New Issue
Block a user