Skip to content

Commit

Permalink
Merge pull request #1212 from openkraken/fix/dispose_scrollable
Browse files Browse the repository at this point in the history
fix: fix scroller not disposed when element disposed.
  • Loading branch information
answershuto authored Mar 12, 2022
2 parents a40ab6d + 5127e02 commit 051dacd
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 051dacd

Please sign in to comment.