diff --git a/pkgs/leak_tracker/CHANGELOG.md b/pkgs/leak_tracker/CHANGELOG.md index 3082e097..7f0c0713 100644 --- a/pkgs/leak_tracker/CHANGELOG.md +++ b/pkgs/leak_tracker/CHANGELOG.md @@ -1,3 +1,7 @@ +# 9.0.3 + +* Stop failing if an object is disposed twice. + # 9.0.2 * Make sure phase bondaries are handled correctly. diff --git a/pkgs/leak_tracker/lib/src/leak_tracking/_object_record.dart b/pkgs/leak_tracker/lib/src/leak_tracking/_object_record.dart index abf1ba91..04a87306 100644 --- a/pkgs/leak_tracker/lib/src/leak_tracking/_object_record.dart +++ b/pkgs/leak_tracker/lib/src/leak_tracking/_object_record.dart @@ -107,7 +107,10 @@ class ObjectRecord { int? _disposalGcCount; void setDisposed(int gcTime, DateTime time) { - if (_disposalGcCount != null) throw 'The object $code was disposed twice.'; + // TODO(polina-c): handle double disposal in a better way + // https://github.com/dart-lang/leak_tracker/issues/118 + // Noop if object is already disposed. + if (_disposalGcCount != null) return; if (_gcedGcCount != null) { throw 'The object $code should not be disposed after being GCed.'; } diff --git a/pkgs/leak_tracker/pubspec.yaml b/pkgs/leak_tracker/pubspec.yaml index 7add0200..0f8e5f42 100644 --- a/pkgs/leak_tracker/pubspec.yaml +++ b/pkgs/leak_tracker/pubspec.yaml @@ -1,5 +1,5 @@ name: leak_tracker -version: 9.0.2 +version: 9.0.3 description: A framework for memory leak tracking for Dart and Flutter applications. repository: https://github.com/dart-lang/leak_tracker/tree/main/pkgs/leak_tracker