gui_client: fix diff mode display corruption via deepcopy on emit
jay_merge_full/jay_merge_update mutates _state nested dicts in place. The previously emitted dict(_state) was a shallow copy sharing those nested dicts, so background-thread merges retroactively corrupted already-emitted snapshots: timestamps were correct (strings are immutable) but Y values all converged to the latest record's values. Fix: emit copy.deepcopy(_state) so each snapshot is fully independent. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+2
-1
@@ -13,6 +13,7 @@ Plot — time-series charts of all physical {value, unit} fields
|
|||||||
|
|
||||||
import json
|
import json
|
||||||
import socket
|
import socket
|
||||||
|
import copy
|
||||||
import sys
|
import sys
|
||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
@@ -163,7 +164,7 @@ class TcpReader(QObject):
|
|||||||
self._state = jay_merge_full(self._state, diff)
|
self._state = jay_merge_full(self._state, diff)
|
||||||
else:
|
else:
|
||||||
self._state = data
|
self._state = data
|
||||||
self.message.emit(dict(self._state))
|
self.message.emit(copy.deepcopy(self._state))
|
||||||
else:
|
else:
|
||||||
self.message.emit(data)
|
self.message.emit(data)
|
||||||
except json.JSONDecodeError:
|
except json.JSONDecodeError:
|
||||||
|
|||||||
Reference in New Issue
Block a user