Title: [107849] trunk/Source/WebCore
Revision
107849
Author
[email protected]
Date
2012-02-15 15:47:26 -0800 (Wed, 15 Feb 2012)

Log Message

Scrolling Coordinator must be deleted on the main thread
https://bugs.webkit.org/show_bug.cgi?id=78756
<rdar://problem/10866167>

Reviewed by Sam Weinig.

ScrollingTree::invalidate will finish breaking the cycle between the scrolling coordinator and the
scrolling tree by dereffing the scrolling coordinator. We need to make sure that this happens on the main
thread because the scrolling coordinator expects to be destroyed from there.

* page/scrolling/ScrollingTree.cpp:
(WebCore::derefScrollingCoordinator):
(WebCore):
(WebCore::ScrollingTree::invalidate):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (107848 => 107849)


--- trunk/Source/WebCore/ChangeLog	2012-02-15 23:37:25 UTC (rev 107848)
+++ trunk/Source/WebCore/ChangeLog	2012-02-15 23:47:26 UTC (rev 107849)
@@ -1,5 +1,22 @@
 2012-02-15  Anders Carlsson  <[email protected]>
 
+        Scrolling Coordinator must be deleted on the main thread
+        https://bugs.webkit.org/show_bug.cgi?id=78756
+        <rdar://problem/10866167>
+
+        Reviewed by Sam Weinig.
+
+        ScrollingTree::invalidate will finish breaking the cycle between the scrolling coordinator and the
+        scrolling tree by dereffing the scrolling coordinator. We need to make sure that this happens on the main
+        thread because the scrolling coordinator expects to be destroyed from there.
+
+        * page/scrolling/ScrollingTree.cpp:
+        (WebCore::derefScrollingCoordinator):
+        (WebCore):
+        (WebCore::ScrollingTree::invalidate):
+
+2012-02-15  Anders Carlsson  <[email protected]>
+
         Scrolling coordinator should handle pages being restored from the page cache
         https://bugs.webkit.org/show_bug.cgi?id=78753
         <rdar://problem/10866171>

Modified: trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp (107848 => 107849)


--- trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp	2012-02-15 23:37:25 UTC (rev 107848)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp	2012-02-15 23:47:26 UTC (rev 107849)
@@ -104,13 +104,24 @@
     m_rootNode->setScrollPosition(scrollPosition);
 }
 
+static void derefScrollingCoordinator(ScrollingCoordinator* scrollingCoordinator)
+{
+    ASSERT(isMainThread());
+
+    scrollingCoordinator->deref();
+}
+
 void ScrollingTree::invalidate()
 {
     // Invalidate is dispatched by the ScrollingCoordinator class on the ScrollingThread
     // to break the reference cycle between ScrollingTree and ScrollingCoordinator when the
     // ScrollingCoordinator's page is destroyed.
     ASSERT(ScrollingThread::isCurrentThread());
-    m_scrollingCoordinator = nullptr;
+
+    // Since this can potentially be the last reference to the scrolling coordinator,
+    // we need to release it on the main thread since it has member variables (such as timers)
+    // that expect to be destroyed from the main thread.
+    callOnMainThread(bind(derefScrollingCoordinator, m_scrollingCoordinator.release().leakRef()));
 }
 
 void ScrollingTree::commitNewTreeState(PassOwnPtr<ScrollingTreeState> scrollingTreeState)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to