From: luozheng <1732036298@qq.com> Date: Fri, 11 Oct 2024 08:55:05 +0000 (+0800) Subject: 解决关机动画界面内存泄漏问题 X-Git-Tag: release_V1.2.70_20241020_135402~83 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=486e74d5d1bee4c597f692275a638732e36b9814;p=mirrors%2FFD230.git 解决关机动画界面内存泄漏问题 --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/include/ShutDownImageAnimatorView.h b/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/include/ShutDownImageAnimatorView.h index 653ffb8c5..0e23c99d6 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/include/ShutDownImageAnimatorView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/include/ShutDownImageAnimatorView.h @@ -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}; }; diff --git a/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/ShutDownImageAnimatorView.cpp b/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/ShutDownImageAnimatorView.cpp index ca29a381e..29d932b1b 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/ShutDownImageAnimatorView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/ShutDownImageAnimatorView.cpp @@ -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;