fix, flutter, peer info event may be changed accidentally
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
parent
7480ead76a
commit
1d3ce2c029
@ -628,7 +628,9 @@ class FfiModel with ChangeNotifier {
|
|||||||
|
|
||||||
/// Handle the peer info event based on [evt].
|
/// Handle the peer info event based on [evt].
|
||||||
handlePeerInfo(Map<String, dynamic> evt, String peerId, bool isCache) async {
|
handlePeerInfo(Map<String, dynamic> evt, String peerId, bool isCache) async {
|
||||||
cachedPeerData.peerInfo = evt;
|
// Map clone is required here, otherwise "evt" may be changed by other threads through the reference.
|
||||||
|
// Because this function is asynchronous, there's an "await" in this function.
|
||||||
|
cachedPeerData.peerInfo = {...evt};
|
||||||
|
|
||||||
// recent peer updated by handle_peer_info(ui_session_interface.rs) --> handle_peer_info(client.rs) --> save_config(client.rs)
|
// recent peer updated by handle_peer_info(ui_session_interface.rs) --> handle_peer_info(client.rs) --> save_config(client.rs)
|
||||||
bind.mainLoadRecentPeers();
|
bind.mainLoadRecentPeers();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user