Skip to content

Commit

Permalink
ScrollingStateScrollingNode destructor should be able to handle being…
Browse files Browse the repository at this point in the history
… called before being attached to a tree.

https://bugs.webkit.org/show_bug.cgi?id=264722
rdar://117803479

Reviewed by Alex Christensen.

Adding null check to handle the case when destructor being called before being attached to a tree.

* Source/WebCore/page/scrolling/ScrollingStateNode.h:
(WebCore::ScrollingStateNode::isAttachedToScrollingStateTree const):
* Source/WebCore/page/scrolling/ScrollingStateScrollingNode.cpp:
(WebCore::ScrollingStateScrollingNode::~ScrollingStateScrollingNode):

Canonical link: https://commits.webkit.org/270696@main
  • Loading branch information
lericaa authored and cdumez committed Nov 14, 2023
1 parent e469aed commit 6944158
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions Source/WebCore/page/scrolling/ScrollingStateNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ class ScrollingStateNode : public ThreadSafeRefCountedAndCanMakeThreadSafeWeakPt
const LayerRepresentation& layer() const { return m_layer; }
WEBCORE_EXPORT void setLayer(const LayerRepresentation&);

bool isAttachedToScrollingStateTree() const { return !!m_scrollingStateTree; }
ScrollingStateTree& scrollingStateTree() const
{
ASSERT(m_scrollingStateTree);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ ScrollingStateScrollingNode::ScrollingStateScrollingNode(const ScrollingStateScr

ScrollingStateScrollingNode::~ScrollingStateScrollingNode()
{
scrollingStateTree().scrollingNodeRemoved();
if (isAttachedToScrollingStateTree())
scrollingStateTree().scrollingNodeRemoved();
}

OptionSet<ScrollingStateNode::Property> ScrollingStateScrollingNode::applicableProperties() const
Expand Down

0 comments on commit 6944158

Please sign in to comment.