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 |   26 +++++++++++++++++++++++++-
 1 files changed, 25 insertions(+), 1 deletions(-)

diff --git a/SourceCode/Bond/Servo/CEquipment.cpp b/SourceCode/Bond/Servo/CEquipment.cpp
index 4baffcc..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;
 		}
@@ -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)

--
Gitblit v1.9.3