Skip to content

Commit 2c321ea

Browse files
DanTupCommit Queue
authored and
Commit Queue
committed
[analyzer] Ensure wrapped watcher streams are cancelled when subscriber cancels
Fixes #51746. Change-Id: If5e98eef60c9404378c7bbb050fcfbe6a6d807f2 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289080 Commit-Queue: Brian Wilkerson <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]>
1 parent 3ad4594 commit 2c321ea

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pkg/analyzer/lib/file_system/physical_file_system.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,10 +425,12 @@ abstract class _PhysicalResource implements Resource {
425425
}
426426

427427
final mappedEventsController = StreamController<WatchEvent>();
428-
original.listen(
428+
final subscription = original.listen(
429429
mappedEventsController.add,
430430
onError: (Object e) => mappedEventsController.addError(mapException(e)),
431+
onDone: () => mappedEventsController.close(),
431432
);
433+
mappedEventsController.onCancel = subscription.cancel;
432434
return mappedEventsController.stream;
433435
}
434436
}

0 commit comments

Comments
 (0)