Skip to content

Commit

Permalink
fix: fix scroller not disposed when element disposed.
Browse files Browse the repository at this point in the history
  • Loading branch information
andycall committed Mar 11, 2022
1 parent a9f5a25 commit 5127e02
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions kraken/lib/src/css/overflow.dart
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ mixin ElementOverflowMixin on ElementBase {
KrakenScrollable? _scrollableY;

void disposeScrollable() {
_scrollableX?.position?.dispose();
_scrollableY?.position?.dispose();
_scrollableX = null;
_scrollableY = null;
}
Expand Down
4 changes: 3 additions & 1 deletion kraken/lib/src/dom/element.dart
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,9 @@ class Element extends Node
disposeRenderObject();
}

// Should make sure Scrollable.position are disposed earlier than RenderBoxModel.
disposeScrollable();

RenderBoxModel? _renderBoxModel = renderBoxModel;
Element? _parentElement = parentElement;

Expand All @@ -661,7 +664,6 @@ class Element extends Node
renderStyle.detach();
style.dispose();
properties.clear();
disposeScrollable();

super.dispose();
}
Expand Down

0 comments on commit 5127e02

Please sign in to comment.