EventHandler references deleted Scrollbar
authorbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 24 Feb 2015 04:09:21 +0000 (04:09 +0000)
committerbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 24 Feb 2015 04:09:21 +0000 (04:09 +0000)
commit69fc167744e820b6bef554e2cf048abda30bfaa4
tree55325f57b2fc440be2074d4098449cee8f31f0a4
parent519697dc39e702674b57be10e43b8c9a776a3ca6
EventHandler references deleted Scrollbar
https://bugs.webkit.org/show_bug.cgi?id=141931
<rdar://problem/19915210>

Reviewed by Tim Horton.

Tested by scrollbars/overflow-custom-scrollbar-crash.html

Update the EventHandler class to use a WeakPtr to reference the
last used Scrollbar, rather than retaining the Scrollbar and
artificially extending its life. This keeps the EventHandler
state in proper sync with the state of the render tree, and
avoids cases where we have destroyed a ScrollableArea (and
Scrollbar) but are still sending messages to a fake zombie
version of the element.

* page/EventHandler.cpp:
(WebCore::EventHandler::clear):
(WebCore::EventHandler::handleMousePressEvent):
(WebCore::EventHandler::updateMouseEventTargetNode):
(WebCore::EventHandler::updateLastScrollbarUnderMouse):
* page/EventHandler.h:
* platform/Scrollbar.cpp:
(WebCore::Scrollbar::Scrollbar): Initialize WeakPtrFactory.
* platform/Scrollbar.h:
(WebCore::Scrollbar::createWeakPtr): Added,

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@180548 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/page/EventHandler.cpp
Source/WebCore/page/EventHandler.h
Source/WebCore/platform/Scrollbar.cpp
Source/WebCore/platform/Scrollbar.h