From fbc7719e6c3386418014b92c033d84a3c930e58b Mon Sep 17 00:00:00 2001
From: chenluhua1980 <Chenluhua@qq.com>
Date: 星期六, 24 一月 2026 16:38:42 +0800
Subject: [PATCH] 1.搬出物料上限修改为1,且退出时释放内存;

---
 SourceCode/Bond/Servo/CMaster.cpp |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/SourceCode/Bond/Servo/CMaster.cpp b/SourceCode/Bond/Servo/CMaster.cpp
index bf1ff4b..df5bff5 100644
--- a/SourceCode/Bond/Servo/CMaster.cpp
+++ b/SourceCode/Bond/Servo/CMaster.cpp
@@ -119,6 +119,14 @@
 			m_hEventDispatchThreadExit[1] = nullptr;
 		}
 
+		// 閲婃斁浜哄伐鎼嚭缂撳啿鍖洪噷鐨勭幓鐠�
+		for (auto* pGlass : m_bufGlass) {
+			if (pGlass != nullptr) {
+				pGlass->release();
+			}
+		}
+		m_bufGlass.clear();
+
 		DeleteCriticalSection(&m_criticalSection);
 	}
 
@@ -3551,6 +3559,15 @@
 		if (pSlot == nullptr) return false;
 
 		CGlass* pGlass = (CGlass*)pSlot->getContext();
+		if (pGlass == nullptr) return false;
+
+		// Buffer 涓婇檺涓� 1锛氭柊鎼嚭鏃朵涪寮冩棫鐨�
+		if (!m_bufGlass.empty()) {
+			for (auto* oldGlass : m_bufGlass) {
+				if (oldGlass != nullptr) oldGlass->release();
+			}
+			m_bufGlass.clear();
+		}
 		m_bufGlass.push_back(pGlass);
 		pGlass->addRef();
 		pSlot->setContext(nullptr);

--
Gitblit v1.9.3