Unverified Commit 6b500fa7 authored by Kinarobin's avatar Kinarobin Committed by GitHub

dispose image when cache clear (#76600)

parent c8c681f6
......@@ -188,6 +188,9 @@ class ImageCache {
},
);
}
for (final _CachedImage image in _cache.values) {
image.dispose();
}
_cache.clear();
_pendingImages.clear();
_currentSizeBytes = 0;
......
......@@ -34,7 +34,7 @@ void main() {
await tester.pumpWidget(TestWidget(key));
final DisposableBuildContext context = DisposableBuildContext(key.currentState!);
final TestImageProvider testImageProvider = TestImageProvider(testImage);
final TestImageProvider testImageProvider = TestImageProvider(testImage.clone());
final ScrollAwareImageProvider<TestImageProvider> imageProvider = ScrollAwareImageProvider<TestImageProvider>(
context: context,
imageProvider: testImageProvider,
......@@ -69,7 +69,7 @@ void main() {
));
final DisposableBuildContext context = DisposableBuildContext(key.currentState!);
final TestImageProvider testImageProvider = TestImageProvider(testImage);
final TestImageProvider testImageProvider = TestImageProvider(testImage.clone());
final ScrollAwareImageProvider<TestImageProvider> imageProvider = ScrollAwareImageProvider<TestImageProvider>(
context: context,
imageProvider: testImageProvider,
......@@ -109,7 +109,7 @@ void main() {
));
final DisposableBuildContext context = DisposableBuildContext(keys.last.currentState!);
final TestImageProvider testImageProvider = TestImageProvider(testImage);
final TestImageProvider testImageProvider = TestImageProvider(testImage.clone());
final ScrollAwareImageProvider<TestImageProvider> imageProvider = ScrollAwareImageProvider<TestImageProvider>(
context: context,
imageProvider: testImageProvider,
......@@ -166,7 +166,7 @@ void main() {
));
final DisposableBuildContext context = DisposableBuildContext(keys.last.currentState!);
final TestImageProvider testImageProvider = TestImageProvider(testImage);
final TestImageProvider testImageProvider = TestImageProvider(testImage.clone());
final ScrollAwareImageProvider<TestImageProvider> imageProvider = ScrollAwareImageProvider<TestImageProvider>(
context: context,
imageProvider: testImageProvider,
......@@ -233,7 +233,7 @@ void main() {
));
final DisposableBuildContext context = DisposableBuildContext(keys.last.currentState!);
final TestImageProvider testImageProvider = TestImageProvider(testImage);
final TestImageProvider testImageProvider = TestImageProvider(testImage.clone());
final ScrollAwareImageProvider<TestImageProvider> imageProvider = ScrollAwareImageProvider<TestImageProvider>(
context: context,
imageProvider: testImageProvider,
......@@ -298,7 +298,7 @@ void main() {
));
final DisposableBuildContext context = DisposableBuildContext(key.currentState!);
final TestImageProvider testImageProvider = TestImageProvider(testImage);
final TestImageProvider testImageProvider = TestImageProvider(testImage.clone());
final ScrollAwareImageProvider<TestImageProvider> imageProvider = ScrollAwareImageProvider<TestImageProvider>(
context: context,
imageProvider: testImageProvider,
......@@ -349,7 +349,7 @@ void main() {
));
final DisposableBuildContext context = DisposableBuildContext(key.currentState!);
final TestImageProvider testImageProvider = TestImageProvider(testImage);
final TestImageProvider testImageProvider = TestImageProvider(testImage.clone());
final ScrollAwareImageProvider<TestImageProvider> imageProvider = ScrollAwareImageProvider<TestImageProvider>(
context: context,
imageProvider: testImageProvider,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment