File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -525,15 +525,14 @@ class Room extends DisposableChangeNotifier with EventsEmittable<RoomEvent> {
525525 _serverVersion = null ;
526526 _serverRegion = null ;
527527
528+ final participants = _remoteParticipants.toList ();
529+ _remoteParticipants.clear ();
528530 _activeSpeakers.clear ();
529-
530- // Clean up RemoteParticipants
531- for (final participant in _remoteParticipants) {
531+ for (final participant in participants) {
532532 events.emit (ParticipantDisconnectedEvent (participant: participant));
533533 await participant.removeAllPublishedTracks (notify: false );
534534 await participant.dispose ();
535535 }
536- _remoteParticipants.clear ();
537536
538537 notifyListeners ();
539538 })
@@ -965,12 +964,13 @@ extension RoomPrivateMethods on Room {
965964 logger.fine ('[${objectId }] cleanUp()' );
966965
967966 // clean up RemoteParticipants
968- for (final participant in _remoteParticipants) {
967+ final participants = _remoteParticipants.toList ();
968+ _remoteParticipants.clear ();
969+ for (final participant in participants) {
969970 await participant.removeAllPublishedTracks (notify: false );
970971 // RemoteParticipant is responsible for disposing resources
971972 await participant.dispose ();
972973 }
973- _remoteParticipants.clear ();
974974 _pendingTrackQueue.clear ();
975975
976976 // clean up LocalParticipant
You can’t perform that action at this time.
0 commit comments