Skip to content

Commit

Permalink
TW-1650: must await on cancel before remove item in list
Browse files Browse the repository at this point in the history
  • Loading branch information
sherlockvn committed May 3, 2024
1 parent ab76d9d commit d4a95bb
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/widgets/matrix.dart
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ class MatrixState extends State<Matrix>
LoginState state,
Client currentClient,
) async {
_cancelSubs(currentClient.clientName);
await _cancelSubs(currentClient.clientName);
widget.clients.remove(currentClient);
ClientManager.removeClientNameFromStore(currentClient.clientName);
TwakeSnackBar.show(
Expand Down Expand Up @@ -466,14 +466,14 @@ class MatrixState extends State<Matrix>
}
}

void _cancelSubs(String name) {
onRoomKeyRequestSub[name]?.cancel();
Future<void> _cancelSubs(String name) async {
await onRoomKeyRequestSub[name]?.cancel();
onRoomKeyRequestSub.remove(name);
onKeyVerificationRequestSub[name]?.cancel();
await onKeyVerificationRequestSub[name]?.cancel();
onKeyVerificationRequestSub.remove(name);
onLoginStateChanged[name]?.cancel();
await onLoginStateChanged[name]?.cancel();
onLoginStateChanged.remove(name);
onNotification[name]?.cancel();
await onNotification[name]?.cancel();
onNotification.remove(name);
}

Expand Down

0 comments on commit d4a95bb

Please sign in to comment.