From: luozheng <1732036298@qq.com> Date: Sat, 25 Apr 2026 08:51:25 +0000 (+0800) Subject: 解决进入省电模式界面内存泄漏问题 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=refs%2Fchanges%2F3373%2Ftarget%2F1;p=mirrors%2FFD230.git 解决进入省电模式界面内存泄漏问题 --- diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/calendar/src/CalendarPresenter.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/calendar/src/CalendarPresenter.cpp index 43766067e..b4c586498 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/calendar/src/CalendarPresenter.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/calendar/src/CalendarPresenter.cpp @@ -52,14 +52,14 @@ namespace OHOS bool CalendarPresenter::OnClick(UIView &view, const ClickEvent &event) { UNUSED(event); - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "OnClick"); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "OnClick"); return false; } bool CalendarPresenter::OnDragEnd(OHOS::UIView &view, const OHOS::DragEvent &event) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter OnDragEnd"); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter OnDragEnd"); if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT) { if (event.GetPreLastPoint().x - event.GetStartPoint().x > 100) diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/saveele/src/SaveBatView.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/saveele/src/SaveBatView.cpp index 07dc378e5..3fabd847c 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/saveele/src/SaveBatView.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/saveele/src/SaveBatView.cpp @@ -336,8 +336,11 @@ namespace OHOS /* 关闭省电模式 */ uapi_exit_power_saving_mode(); - // UIViewGroup *tmpGroup = dynamic_cast(group_); - // UIViewGroup::RemoveAndDeleteAllRecursively(tmpGroup); + if (group_) { + group_->RemoveAll(); + delete group_; + group_ = nullptr; + } // 释放所有动态分配的成员变量 if (timelabel) { @@ -402,11 +405,7 @@ namespace OHOS if (restart_) { delete restart_; restart_ = nullptr; - } - if (group_) { - delete group_; - group_ = nullptr; - } + } if (label_) { delete label_; label_ = nullptr;