From 44360bc2cdeee16be72f9cc4bfb42e0ac26b5b44 Mon Sep 17 00:00:00 2001
From: chenluhua1980 <Chenluhua@qq.com>
Date: 星期一, 19 一月 2026 14:47:19 +0800
Subject: [PATCH] 1.修改优化

---
 SourceCode/Bond/Servo/CMaster.cpp |   12 ++++++------
 SourceCode/Bond/Servo/CMaster.h   |    5 +++++
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/SourceCode/Bond/Servo/CMaster.cpp b/SourceCode/Bond/Servo/CMaster.cpp
index 90b4d23..29a89f3 100644
--- a/SourceCode/Bond/Servo/CMaster.cpp
+++ b/SourceCode/Bond/Servo/CMaster.cpp
@@ -234,7 +234,7 @@
 		readCache();
 		loadState();
 		if (m_listener.onControlJobChanged) {
-			m_listener.onControlJobChanged(this);
+			notifyControlJobChanged();
 		}
 
 
@@ -2896,7 +2896,7 @@
 
 		this->saveState();
 		if (m_listener.onControlJobChanged) {
-			m_listener.onControlJobChanged(this);
+			notifyControlJobChanged();
 		}
 
 		return (int)m_processJobs.size();
@@ -2956,7 +2956,7 @@
 		m_pControlJob->setPJs(temps);
 		this->saveState();
 		if (m_listener.onControlJobChanged) {
-			m_listener.onControlJobChanged(this);
+			notifyControlJobChanged();
 		}
 
 
@@ -3077,7 +3077,7 @@
 		}
 		if (pausedAny && m_listener.onControlJobChanged) {
 			// 閫氱煡搴旂敤灞傚埛鏂� UI/鎸夐挳鐘舵��
-			m_listener.onControlJobChanged(this);
+			notifyControlJobChanged();
 		}
 		if (pausedAny && !m_bPauseAlarmRaised) {
 			std::string desc = CToolUnits::formatString("<PauseEvent CEID=%u>", ceid);
@@ -3392,7 +3392,7 @@
 
 		saveState();
 		if (m_listener.onControlJobChanged) {
-			m_listener.onControlJobChanged(this);
+			notifyControlJobChanged();
 		}
 
 		return true;
@@ -3429,7 +3429,7 @@
 
 		saveState();
 		if (m_listener.onControlJobChanged) {
-			m_listener.onControlJobChanged(this);
+			notifyControlJobChanged();
 		}
 
 		return true;
diff --git a/SourceCode/Bond/Servo/CMaster.h b/SourceCode/Bond/Servo/CMaster.h
index c1f1755..35eb6fc 100644
--- a/SourceCode/Bond/Servo/CMaster.h
+++ b/SourceCode/Bond/Servo/CMaster.h
@@ -296,5 +296,10 @@
     private:
         Collector* m_pCollector = nullptr;
         void CreateDAQBridgeServer();
+        inline void notifyControlJobChanged() {
+            if (m_listener.onControlJobChanged) {
+                m_listener.onControlJobChanged(this);
+            }
+        }
     };
 }

--
Gitblit v1.9.3