修改Camera.cs的UpdateImageOnUI方法,创建LastImage的副本并传递给Setting窗口

This commit is contained in:
zqm
2025-11-11 10:23:43 +08:00
parent 28a9846da6
commit cee73c3751

View File

@@ -1,4 +1,4 @@
using System; using System;
using System.IO; using System.IO;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
@@ -823,12 +823,16 @@ namespace JoyD.Windows.CS.Toprie
imageBox.Image = tempImage; imageBox.Image = tempImage;
// 步骤5同步更新检测配置窗口的实时图像属性 // 步骤5同步更新检测配置窗口的实时图像属性
if (tempImage != null) // 创建LastImage的副本并通过UpdateRealTimeImage方法传递给Setting窗口
lock (_lastImageLock)
{ {
// 创建图像副本以避免线程安全问题 if (_lastImage != null)
Image clonedImage = (Image)tempImage.Clone(); {
// 直接创建LastImage的副本以避免线程安全问题
Image lastImageCopy = (Image)_lastImage.Clone();
// 调用Setting窗口的方法更新实时温度图像 // 调用Setting窗口的方法更新实时温度图像
Setting.Form.UpdateRealTimeImage(clonedImage); Setting.Form.UpdateRealTimeImage(lastImageCopy);
}
} }
if (lastImage != null) if (lastImage != null)