From d7c88780e1df54f34563d60bd7fa01011d2eef03 Mon Sep 17 00:00:00 2001
From: chenluhua1980 <Chenluhua@qq.com>
Date: 星期一, 26 一月 2026 23:17:17 +0800
Subject: [PATCH] 1.CSVData.cpp 里 unserialize 用了 8*2、125*2,但 serialize 只写 8 + 125 字节。 m_svRawData.insert 的 end 指针是 pszBuffer + 125*2,没有用 index 计算,可能把无效区域一起拷进去。 一旦 size 实际是 133(不是 266),就会直接越界,堆会被破坏,m_svDatas.clear() 在销毁元素时崩。
---
SourceCode/Bond/Servo/CMaster.cpp | 51 +++++++++++++++++++++++++++++++++++++++------------
1 files changed, 39 insertions(+), 12 deletions(-)
diff --git a/SourceCode/Bond/Servo/CMaster.cpp b/SourceCode/Bond/Servo/CMaster.cpp
index 9adc527..c17be6b 100644
--- a/SourceCode/Bond/Servo/CMaster.cpp
+++ b/SourceCode/Bond/Servo/CMaster.cpp
@@ -119,6 +119,7 @@
m_hEventDispatchThreadExit[1] = nullptr;
}
+
DeleteCriticalSection(&m_criticalSection);
}
@@ -295,11 +296,11 @@
};
for (uint32_t mid : mids) {
if (mode == CurveMode::EmptyChamber) {
- m_pCollector->buffersStart(mid); // 绌鸿厰妯″紡锛氬厑璁告棤鎵规鐩存帴閲囨牱
+ m_pCollector->batchStart(mid, "EMPTY_CHAMBER", 30 * 60 * 1000ULL); // 绌鸿厰妯″紡锛氬惎鍔ㄩ噰鏍锋壒娆�
}
else {
- m_pCollector->buffersStop(mid);
- m_pCollector->buffersClear(mid);
+ m_pCollector->batchStop(mid);
+ m_pCollector->buffersClear(mid); // 鍒囧洖鐢熶骇妯″紡锛屾竻鎺夌┖鑵旀暟鎹�
}
}
}
@@ -336,6 +337,13 @@
}
m_listEquipment.clear();
+ // release manual-remove buffer before glass pool is torn down
+ for (auto* pGlass : m_bufGlass) {
+ if (pGlass != nullptr) {
+ pGlass->release();
+ }
+ }
+ m_bufGlass.clear();
if (m_pCollector != nullptr) {
m_pCollector->stopLoop();
@@ -1785,18 +1793,23 @@
int paramIndex = mapping.first;
int channel = mapping.second;
- if (paramIndex < params.size() && channel - 1 < vacuumbakeTypes.size()) {
+ if (paramIndex < params.size()) {
auto& param = params.at(paramIndex);
double value = param.getDoubleValue();
- const std::string& dataType = vacuumbakeTypes[channel - 1];
const std::string& paramName = param.getName();
const char slotTag = !paramName.empty() ? paramName[0] : '\0';
+ const int typeIndex = (slotTag == 'B') ? (channel - 8) : (channel - 1);
+ if (typeIndex < 0 || typeIndex >= (int)vacuumbakeTypes.size()) {
+ continue;
+ }
+ const int pushChannel = typeIndex + 1;
+ const std::string& dataType = vacuumbakeTypes[typeIndex];
if (m_pCollector != nullptr) {
if (slotTag == 'A')
- m_pCollector->buffersPush(SlotToMid(eqid, 1), channel, ts, value);
+ m_pCollector->buffersPush(SlotToMid(eqid, 1), pushChannel, ts, value);
else if (slotTag == 'B')
- m_pCollector->buffersPush(SlotToMid(eqid, 2), channel, ts, value);
+ m_pCollector->buffersPush(SlotToMid(eqid, 2), pushChannel, ts, value);
}
// 鏍规嵁鑵斾綋鍓嶇紑鍐欏叆瀵瑰簲 Slot 鐨勭幓鐠�
@@ -1830,20 +1843,25 @@
int paramIndex = mapping.first;
int channel = mapping.second;
- if (paramIndex < params.size() && channel - 1 < coolingTypes.size()) {
+ if (paramIndex < params.size()) {
auto& param = params.at(paramIndex);
double value = param.getDoubleValue();
- const std::string& dataType = coolingTypes[channel - 1];
const std::string& paramName = param.getName();
const char slotTag = !paramName.empty() ? paramName[0] : '\0';
const bool paramIsBake = paramName.find("鐑樼儰") != std::string::npos;
const bool paramIsCooling = paramName.find("鍐峰嵈") != std::string::npos;
+ const int typeIndex = (slotTag == 'B') ? (channel - 7) : (channel - 1);
+ if (typeIndex < 0 || typeIndex >= (int)coolingTypes.size()) {
+ continue;
+ }
+ const int pushChannel = typeIndex + 1;
+ const std::string& dataType = coolingTypes[typeIndex];
if (m_pCollector != nullptr && paramIsBake) {
if (slotTag == 'A')
- m_pCollector->buffersPush(SlotToMid(eqid, 1), channel, ts, value);
+ m_pCollector->buffersPush(SlotToMid(eqid, 1), pushChannel, ts, value);
else if (slotTag == 'B')
- m_pCollector->buffersPush(SlotToMid(eqid, 3), channel, ts, value);
+ m_pCollector->buffersPush(SlotToMid(eqid, 3), pushChannel, ts, value);
}
if (!dataType.empty()) {
@@ -3551,6 +3569,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);
@@ -3662,7 +3689,7 @@
MID_BakeCoolingA, MID_BakeCoolingB
};
for (uint32_t mid : mids) {
- m_pCollector->buffersStart(mid);
+ m_pCollector->batchStart(mid, "EMPTY_CHAMBER", 10 * 60 * 1000ULL);
}
}
}
--
Gitblit v1.9.3