Skip to content

Commit

Permalink
REGRESSION (263108@main): [ Ventura debug ] ASSERTION FAILED: WTF::We…
Browse files Browse the repository at this point in the history
…akPtr<WebKit::RemoteScrollingCoordinatorProxy, WTF::DefaultWeakPtrImpl>::operator->() const

https://bugs.webkit.org/show_bug.cgi?id=255788
rdar://108369779

Reviewed by Tim Horton.

Add a missing bounce to the main thread before calling `scrollingTreeNodeDidBeginScrollSnapping` or
`scrollingTreeNodeDidEndScrollSnapping` in the UI process on macOS.

* Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteScrollingTreeMac.h:
* Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteScrollingTreeMac.mm:
(WebKit::RemoteScrollingTreeMac::scrollingTreeNodeWillStartScroll):
(WebKit::RemoteScrollingTreeMac::scrollingTreeNodeDidEndScroll):

Also harden some existing logic (as well as the new methods below) so that they explicitly protect
`this` when calling out to the main thread.

(WebKit::RemoteScrollingTreeMac::scrollingTreeNodeDidBeginScrollSnapping):
(WebKit::RemoteScrollingTreeMac::scrollingTreeNodeDidEndScrollSnapping):

Canonical link: https://commits.webkit.org/263271@main
  • Loading branch information
whsieh committed Apr 22, 2023
1 parent d910e37 commit f56f385
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
Expand Up @@ -85,6 +85,9 @@ class RemoteScrollingTreeMac final : public RemoteScrollingTree {
void scrollingTreeNodeWillStartScroll(WebCore::ScrollingNodeID) override;
void scrollingTreeNodeDidEndScroll(WebCore::ScrollingNodeID) override;

void scrollingTreeNodeDidBeginScrollSnapping(ScrollingNodeID) override;
void scrollingTreeNodeDidEndScrollSnapping(ScrollingNodeID) override;

Ref<WebCore::ScrollingTreeNode> createScrollingTreeNode(WebCore::ScrollingNodeType, WebCore::ScrollingNodeID) override;

HashMap<WebCore::ScrollingNodeID, WebCore::RequestedScrollData> m_nodesWithPendingScrollAnimations; // Guarded by m_treeLock but used via call chains that can't be annotated.
Expand Down
Expand Up @@ -73,18 +73,32 @@

void RemoteScrollingTreeMac::scrollingTreeNodeWillStartScroll(ScrollingNodeID nodeID)
{
RunLoop::main().dispatch([this, nodeID] {
RunLoop::main().dispatch([protectedThis = Ref { *this }, this, nodeID] {
RemoteScrollingTree::scrollingTreeNodeWillStartScroll(nodeID);
});
}

void RemoteScrollingTreeMac::scrollingTreeNodeDidEndScroll(ScrollingNodeID nodeID)
{
RunLoop::main().dispatch([this, nodeID] {
RunLoop::main().dispatch([protectedThis = Ref { *this }, this, nodeID] {
RemoteScrollingTree::scrollingTreeNodeDidEndScroll(nodeID);
});
}

void RemoteScrollingTreeMac::scrollingTreeNodeDidBeginScrollSnapping(ScrollingNodeID nodeID)
{
RunLoop::main().dispatch([protectedThis = Ref { *this }, this, nodeID] {
RemoteScrollingTree::scrollingTreeNodeDidBeginScrollSnapping(nodeID);
});
}

void RemoteScrollingTreeMac::scrollingTreeNodeDidEndScrollSnapping(ScrollingNodeID nodeID)
{
RunLoop::main().dispatch([protectedThis = Ref { *this }, this, nodeID] {
RemoteScrollingTree::scrollingTreeNodeDidEndScrollSnapping(nodeID);
});
}

Ref<ScrollingTreeNode> RemoteScrollingTreeMac::createScrollingTreeNode(ScrollingNodeType nodeType, ScrollingNodeID nodeID)
{
switch (nodeType) {
Expand Down

0 comments on commit f56f385

Please sign in to comment.