Skip to content

Commit 9d42ad8

Browse files
authored
Fix memory leak in NestedScrollViewState. (#135248)
1 parent 5def6f2 commit 9d42ad8

File tree

2 files changed

+77
-52
lines changed

2 files changed

+77
-52
lines changed

packages/flutter/lib/src/widgets/nested_scroll_view.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,7 @@ class NestedScrollViewState extends State<NestedScrollView> {
441441
void dispose() {
442442
_coordinator!.dispose();
443443
_coordinator = null;
444+
_absorberHandle.dispose();
444445
super.dispose();
445446
}
446447

@@ -1620,6 +1621,13 @@ class _NestedOuterBallisticScrollActivity extends BallisticScrollActivity {
16201621
/// [SliverOverlapAbsorber] to align its children, and which shows sample
16211622
/// usage for this class.
16221623
class SliverOverlapAbsorberHandle extends ChangeNotifier {
1624+
/// Creates a [SliverOverlapAbsorberHandle].
1625+
SliverOverlapAbsorberHandle() {
1626+
if (kFlutterMemoryAllocationsEnabled) {
1627+
ChangeNotifier.maybeDispatchObjectCreation(this);
1628+
}
1629+
}
1630+
16231631
// Incremented when a RenderSliverOverlapAbsorber takes ownership of this
16241632
// object, decremented when it releases it. This allows us to find cases where
16251633
// the same handle is being passed to two render objects.

0 commit comments

Comments
 (0)