修复血氧Slice的析构
authorCaisking <3449750381@qq.com>
Fri, 27 Sep 2024 07:48:37 +0000 (15:48 +0800)
committerCaisking <3449750381@qq.com>
Fri, 27 Sep 2024 07:48:37 +0000 (15:48 +0800)
code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/include/BloodDetectionView.h
code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/src/BloodDetectionView.cpp
code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/src/BloodResultView.cpp

index 6391754..476ec64 100644 (file)
@@ -56,7 +56,6 @@ namespace OHOS
         UIImageAnimatorView *imageAnimator{nullptr};
         UILabelExt *titleLabel{nullptr};
         UILabel *Spo2Text{nullptr};
-        UIScrollView *BloodDetectionScrollView{nullptr};
         UILabelButtonExt *testButton{nullptr};
 
         uint32_t spo2_;
index 2330481..778290a 100644 (file)
@@ -54,22 +54,30 @@ namespace OHOS
     BloodDetectionView::~BloodDetectionView()
     {
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BloodDetectionView::~BloodDetectionView");
-        // container_->RemoveAll();
-
-        delete titleLabel;
-        titleLabel = nullptr;
-
-        delete testButton;
-        testButton = nullptr;
-
-        imageAnimator->Stop();
-        delete imageAnimator;
-        imageAnimator = nullptr;
-
-        delete Spo2Text;
-        Spo2Text = nullptr;
-
-        g_pBloodCheckView = this;
+        if(container_)
+            container_->RemoveAll();
+        if(titleLabel)
+        {
+            delete titleLabel;
+            titleLabel = nullptr;
+        }
+        if(testButton)
+        {
+            delete testButton;
+            testButton = nullptr;
+        }
+        if(imageAnimator)
+        {
+            imageAnimator->Stop();
+            delete imageAnimator;
+            imageAnimator = nullptr;   
+        }
+        if(Spo2Text)
+        {
+            delete Spo2Text;
+            Spo2Text = nullptr;  
+        }
+        g_pBloodCheckView = nullptr;
     }
     BloodDetectionView *BloodDetectionView::GetInstance(void)
     {
index 97fe087..4d9615a 100644 (file)
@@ -165,6 +165,10 @@ namespace OHOS
      */
     void BloodResultView::DeInit()
     {
+        if(container_)
+        {
+            container_->RemoveAll();
+        }
         if (background != nullptr)
         {
             delete background;
@@ -185,6 +189,11 @@ namespace OHOS
             delete titleLabel;
             titleLabel = nullptr;
         }
+        if(checkButton!=nullptr)
+        {
+            delete checkButton;
+            checkButton = nullptr;
+        }
     }
 
     void BloodResultView::OnStart()