From f0928d2abc4f3b5875d27b1beeb393cf5edf8c4a Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期一, 24 三月 2025 15:30:38 +0800
Subject: [PATCH] 1.Master数据的缓存,主动关闭程序,或程序闪退,可重启还原。
---
SourceCode/Bond/Servo/CEquipment.cpp | 32 ++++++++++++++++++++++++++++++--
1 files changed, 30 insertions(+), 2 deletions(-)
diff --git a/SourceCode/Bond/Servo/CEquipment.cpp b/SourceCode/Bond/Servo/CEquipment.cpp
index c24767e..393191b 100644
--- a/SourceCode/Bond/Servo/CEquipment.cpp
+++ b/SourceCode/Bond/Servo/CEquipment.cpp
@@ -22,6 +22,11 @@
CEquipment::~CEquipment()
{
+ for (auto item : m_glassList) {
+ item->release();
+ }
+ m_glassList.clear();
+
for (auto item : m_mapStep) {
delete item.second;
}
@@ -202,7 +207,7 @@
}
for (auto item : m_glassList) {
- attrubutes.addAttribute(new CAttribute("Panel",
+ attrubutes.addAttribute(new CAttribute("Glass",
item->getID().c_str(), ""));
}
}
@@ -253,7 +258,26 @@
void CEquipment::serialize(CArchive& ar)
{
-
+ if (ar.IsStoring()) {
+ Lock();
+ int count = (int)m_glassList.size();
+ ar << count;
+ for (auto item : m_glassList) {
+ item->serialize(ar);
+ }
+ Unlock();
+ }
+ else {
+ Lock();
+ int count;
+ ar >> count;
+ for (int i = 0; i < count; i++) {
+ CGlass* pGlass = new CGlass();
+ pGlass->serialize(ar);
+ addGlassToList(pGlass);
+ }
+ Unlock();
+ }
}
void CEquipment::onReceiveLBData(const char* pszData, size_t size)
@@ -524,6 +548,10 @@
// 模拟取出第一张Panel,传送到下一环节
Lock();
+ if (m_glassList.empty()) {
+ Unlock();
+ return -2;
+ }
CGlass* pContext = m_glassList.front();
pContext->addRef();
--
Gitblit v1.9.3