From: luozheng <1732036298@qq.com> Date: Thu, 15 Jan 2026 10:22:18 +0000 (+0800) Subject: 解决GPS产测页面内存泄漏问题 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=e690a0e3374b04e5203a511a382a44dc6ea21ad9;p=mirrors%2FFD230.git 解决GPS产测页面内存泄漏问题 --- diff --git a/code/sdk/zhihui/UI/producttest/src/testGPS.cpp b/code/sdk/zhihui/UI/producttest/src/testGPS.cpp index 98dc41ef5..6268510cf 100644 --- a/code/sdk/zhihui/UI/producttest/src/testGPS.cpp +++ b/code/sdk/zhihui/UI/producttest/src/testGPS.cpp @@ -33,18 +33,33 @@ namespace OHOS { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "testGPSView::~testGPSView"); ClearAll(); - //g_pSystemAboutTheWatchView = nullptr; + g_pSystemAboutTheWatchView = nullptr; } testGPSView *testGPSView::GetInstance() { - return g_pSystemAboutTheWatchView; } static osTimerId_t GPS_TEST_timer=NULL; void testGPSView::ClearAll() { + // 清理主容器 + if(mainContainer) + { + mainContainer->RemoveAll(); + delete mainContainer; + mainContainer=nullptr; + } + + // 清理滚动内容区域 + if(contentScrollView) + { + contentScrollView->RemoveAll(); + delete contentScrollView; + contentScrollView=nullptr; + } + if (GPS_TEST_timer != NULL) { osTimerStop(GPS_TEST_timer); osTimerDelete(GPS_TEST_timer); @@ -95,21 +110,6 @@ namespace OHOS failtestBtn = nullptr; } - // 清理滚动内容区域 - if(contentScrollView) - { - contentScrollView->RemoveAll(); - delete contentScrollView; - contentScrollView=nullptr; - } - - // 清理主容器 - if(mainContainer) - { - mainContainer->RemoveAll(); - delete mainContainer; - mainContainer=nullptr; - } } UILabelButtonExt *testGPSView::SetTheButton_ext(ButtonConfig_ext_t &buttonconfig)