解决关机动画界面内存泄漏问题
authorluozheng <1732036298@qq.com>
Fri, 11 Oct 2024 08:55:05 +0000 (16:55 +0800)
committerluozheng <1732036298@qq.com>
Fri, 11 Oct 2024 08:55:05 +0000 (16:55 +0800)
code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/include/ShutDownImageAnimatorView.h
code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/ShutDownImageAnimatorView.cpp

index 653ffb8..0e23c99 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-07-20 11:05:46
  * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-09-29 18:03:03
+ * @LastEditTime: 2024-10-11 16:13:29
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/include/ShutDownImageAnimatorView.h
  */
 
@@ -41,7 +41,7 @@ namespace OHOS
         UIViewGroup *group{nullptr};
         UIImageAnimatorView *shutDownImageAnimatorView{nullptr};                      // 关机动画
         ImageAnimatorInfo ShutDownImageInfo[SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES]; // 关机图像的信息
-        const char **ShutDownPathsArray{nullptr};                                     // 关机图片路径数组
+        const ImageInfo **ShutDownPathsArray{nullptr};                               // 关机图片路径数组
         int OperationType;
         bool isShutDownImageAnimatorStart{false};
     };
index ca29a38..29d932b 100644 (file)
@@ -41,7 +41,8 @@ namespace OHOS
                 delete shutDownImageAnimatorView;
                 shutDownImageAnimatorView = nullptr;
             }
-            FreeImagePathsArray(ShutDownPathsArray, SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES);
+            // FreeImageInfoArray(ShutDownPathsArray, SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES);
+            FreeImageInfoArray(ShutDownPathsArray,ShutDownPaths,SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES);
             delete group;
             group = nullptr;
         }
@@ -97,7 +98,8 @@ namespace OHOS
     bool ShutDownImageAnimatorView::ShowUpShutDownAnimatorView()
     {
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ShutDownImageAnimatorView::ShowUpShutDownAnimatorView");
-        ShutDownPathsArray = CreateImagePathsArray(ShutDownPaths, SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES);
+        // ShutDownPathsArray = CreateImagePathsArray(ShutDownPaths, SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES);
+        ShutDownPathsArray = CreateImageInfoArray(ShutDownPaths, SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES);
 
         if (shutDownImageAnimatorView == nullptr)
         {
@@ -109,8 +111,10 @@ namespace OHOS
             }
             for (uint8_t i = 0; i < SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES; i++)
             {
-                ShutDownImageInfo[i].imagePath = (ShutDownPathsArray[i]);
-                ShutDownImageInfo[i].imageType = IMG_SRC_FILE_PATH;
+                // ShutDownImageInfo[i].imagePath = (ShutDownPathsArray[i]);
+                // ShutDownImageInfo[i].imageType = IMG_SRC_FILE_PATH;
+                ShutDownImageInfo[i].imageInfo = (ShutDownPathsArray[i]);
+                ShutDownImageInfo[i].imageType = IMG_SRC_IMAGE_INFO;
                 ShutDownImageInfo[i].pos.x = SHUTDOWN_IMAGE_ANIMATOR_VIEW_X;
                 ShutDownImageInfo[i].pos.y = SHUTDOWN_IMAGE_ANIMATOR_VIEW_Y;
                 ShutDownImageInfo[i].width = SHUTDOWN_IMAGE_ANIMATOR_VIEW_W;