fix: DeviceManager 死锁 — threading.Lock 改为 RLock
根因: update_from_dev_info/update_loop_data/update_event/update_heartbeat
在 with self._lock 块内调用 get_or_create(), 后者再次 with self._lock.
Python threading.Lock 不可重入 → 永久阻塞 → GUI 无响应.
修复: self._lock = threading.RLock() (可重入锁)
清理: mqtt_client.py 移除 debug print 和未使用的 sys import
This commit is contained in:
@@ -29,7 +29,7 @@ class DeviceManager:
|
||||
|
||||
def __init__(self):
|
||||
self._devices: dict[str, DeviceInfo] = {}
|
||||
self._lock = threading.Lock()
|
||||
self._lock = threading.RLock() # 可重入锁: update_xxx 内部调用 get_or_create
|
||||
self._callbacks: list[Callable] = []
|
||||
|
||||
def on_change(self, callback: Callable):
|
||||
|
||||
Reference in New Issue
Block a user