From: Caisking <3449750381@qq.com> Date: Fri, 27 Sep 2024 10:01:45 +0000 (+0800) Subject: 快捷训练Slice修改析构 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=4f973e126f2d5f20312f584455e515085fc56264;p=mirrors%2FFD230.git 快捷训练Slice修改析构 --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingView.h b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingView.h index 6b7dac677..f134317a8 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingView.h @@ -36,12 +36,9 @@ namespace OHOS UIView *GetView(); private: - UIView::OnDragListener *draglistener{nullptr}; TraingView(TraingView &&) = delete; TraingView &operator=(TraingView &&) = delete; - UIViewGroup *container_ = nullptr; - UIButton *buttonmore_ = nullptr; UIButton *button1_ = nullptr; UIButton *button2_ = nullptr; diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingView.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingView.cpp index 9f2cbf052..566254486 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingView.cpp @@ -157,7 +157,11 @@ namespace OHOS void TraingView::DeInitView() { - container_->RemoveAll(); + if(container_) + { + container_->RemoveAll(); + } + if (buttonmore_ != nullptr) { delete buttonmore_; @@ -223,19 +227,8 @@ namespace OHOS delete btnmore_image; btnmore_image = nullptr; } - // 删除容器 - if (container_ != nullptr) - { - delete container_; - container_ = nullptr; - } } - UIView *TraingView::GetView() - { - InitView(); - return container_; - } // 设置按键监听 static void SetKeyActListener() { @@ -273,7 +266,7 @@ namespace OHOS container_->SetTouchable(true); container_->SetDraggable(true); - GetView(); + InitView(); SetContainerView(container_); // 增加按键监听 @@ -296,9 +289,12 @@ namespace OHOS { View::OnStop(); - - RootView::GetInstance()->ClearOnKeyActListener(); - //FocusManager::GetInstance()->ClearFocus(); + if (container_ != nullptr) + { + container_->RemoveAll(); + delete container_; + container_ = nullptr; + } RootView::GetInstance()->RemoveAll(); return; }