接近省电界面内存泄漏问题 3292/1 3292/head 3293/target/1
authorluozheng <1732036298@qq.com>
Thu, 19 Mar 2026 08:24:33 +0000 (16:24 +0800)
committerluozheng <1732036298@qq.com>
Thu, 19 Mar 2026 08:24:33 +0000 (16:24 +0800)
code/sdk/application/wearable/fd272/nativeapp/nativeui/calculator/src/CalculatorPresenter.cpp
code/sdk/application/wearable/fd272/nativeapp/nativeui/calendar/src/CalendarPresenter.cpp
code/sdk/application/wearable/fd272/nativeapp/nativeui/makephone/src/MainCallingPresenter.cpp
code/sdk/application/wearable/fd272/nativeapp/nativeui/saveele/src/SaveBatView.cpp
code/sdk/application/wearable/fd272/nativeapp/nativeui/sleep/src/SleepTimeView.cpp

index 67fda82..37de867 100644 (file)
@@ -155,7 +155,7 @@ bool CalculatorPresenter::OnClick(UIView &view, const ClickEvent &event)
 
 bool CalculatorPresenter::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>150) 
index 4376606..b4c5864 100644 (file)
@@ -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)
index f97e9a3..5709289 100644 (file)
@@ -366,8 +366,6 @@ bool MainCallingPresenter::OnClick(UIView& view, const ClickEvent& event)
 
 bool MainCallingPresenter::OnDragEnd(OHOS::UIView& view, const OHOS::DragEvent& event)
 {
-
-     WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter OnDragEnd");
     if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT) 
     {
 
index a8a4d03..2612990 100644 (file)
@@ -335,9 +335,11 @@ namespace OHOS
     {  \r
         /* 关闭省电模式 */  \r
         uapi_exit_power_saving_mode();\r
-\r
-        // UIViewGroup *tmpGroup = dynamic_cast<UIViewGroup *>(group_);\r
-        // UIViewGroup::RemoveAndDeleteAllRecursively(tmpGroup);\r
+        if (group_) { \r
+            group_->RemoveAll();\r
+            delete group_;  \r
+            group_ = nullptr;  \r
+        }  \r
 \r
         // 释放所有动态分配的成员变量  \r
         if (timelabel) {  \r
@@ -403,10 +405,7 @@ namespace OHOS
             delete restart_;  \r
             restart_ = nullptr;  \r
         }  \r
-        if (group_) {  \r
-            delete group_;  \r
-            group_ = nullptr;  \r
-        }  \r
+       \r
         if (label_) {  \r
             delete label_;  \r
             label_ = nullptr;  \r
index d530629..3c97001 100644 (file)
@@ -12,7 +12,7 @@ static std::string sleepStr;
 static std::string wakeStr;
 static constexpr char *upimagePath = "/user/res/Sleep/up.bin";
 SleepTimeView::SleepTimeView() {
-  WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SleepTimeView::SleepTimeView");
+  WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SleepTimeView::SleepTimeView");
   SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);
   SetViewIndex(0); // 视图索引
 
@@ -20,7 +20,7 @@ SleepTimeView::SleepTimeView() {
 }
 
 SleepTimeView::~SleepTimeView() {
-  WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, " SleepTimeView::~SleepTimeView");
+  WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, " SleepTimeView::~SleepTimeView");
   ClearAll();
 
   g_pSleepView = nullptr;
@@ -180,7 +180,7 @@ bool SleepTimeView::InitPage(void) {
 }
 
 bool SleepTimeView::InitView(void *caller) {
-  WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SleepTimeView InitView %p", caller);
+  WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SleepTimeView InitView %p", caller);
   if (InitPage() == false) {
     WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SleepTimeView::InitPage fail");
     return false;