diff --git a/lib/widgets/mjpeg.dart b/lib/widgets/mjpeg.dart index fedc382d..fc6c1dca 100644 --- a/lib/widgets/mjpeg.dart +++ b/lib/widgets/mjpeg.dart @@ -175,7 +175,7 @@ class MjpegStreamState { }); } - void dispose() { + void dispose({bool deleting = false}) { for (StreamSubscription subscription in _subscriptions.values) { subscription.cancel(); } @@ -186,6 +186,10 @@ class MjpegStreamState { httpClient.close(); httpClient = Client(); bitCount = 0; + + if (deleting) { + bandwidthTimer.cancel(); + } } void cancelSubscription(Key key) { diff --git a/lib/widgets/nt_widgets/multi-topic/camera_stream.dart b/lib/widgets/nt_widgets/multi-topic/camera_stream.dart index 257f1173..96646eb0 100644 --- a/lib/widgets/nt_widgets/multi-topic/camera_stream.dart +++ b/lib/widgets/nt_widgets/multi-topic/camera_stream.dart @@ -234,7 +234,7 @@ class CameraStreamModel extends MultiTopicNTWidgetModel { if (deleting) { _lastDisplayedImage?.evict(); mjpegStream?.previousImage?.evict(); - mjpegStream?.dispose(); + mjpegStream?.dispose(deleting: deleting); } super.disposeWidget(deleting: deleting); @@ -318,7 +318,7 @@ class CameraStreamWidget extends NTWidget { if (createNewWidget) { model.lastDisplayedImage?.evict(); - model.mjpegStream?.dispose(); + model.mjpegStream?.dispose(deleting: true); model.mjpegStream = MjpegStreamState(stream: stream); } diff --git a/pubspec.yaml b/pubspec.yaml index 302d5ba6..36ce075c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: elastic_dashboard description: A simple and modern dashboard for FRC. publish_to: 'none' -version: 2025.0.0-beta-2 +version: 2025.0.0-beta-3 environment: sdk: '>=3.0.2 <4.0.0'