Changeset 58948 in webkit
- Timestamp:
- May 7, 2010 8:04:58 AM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r58946 r58948 1 2010-05-07 Ben Murdoch <benm@google.com> 2 3 Reviewed by Darin Adler. 4 5 Potential crash in EventHandler::handleTouchEvent 6 https://bugs.webkit.org/show_bug.cgi?id=38646 7 8 Fix a ref counting bug that can cause a crash if the m_originatingouchPointTargets 9 hashmap holds the last ref to an EventTarget when the user lifts their finger. 10 11 This is very hard to reproduce in a consistent way and clearly a 12 simple logic error in the code, therefore no new tests. 13 14 * page/EventHandler.cpp: 15 (WebCore::EventHandler::handleTouchEvent): Don't let the RefPtr we get back from 16 the hasmap go out of scope so soon as it could delete the wrapped ptr if the 17 hashmap held the last ref (and we use the raw ptr that the RefPtr 18 wraps later in the WebCore::Touch constructor). 19 1 20 2010-05-07 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> 2 21 -
trunk/WebCore/page/EventHandler.cpp
r58910 r58948 2783 2783 // Increment the platform touch id by 1 to avoid storing a key of 0 in the hashmap. 2784 2784 unsigned touchPointTargetKey = point.id() + 1; 2785 EventTarget* touchTarget = 0;2785 RefPtr<EventTarget> touchTarget; 2786 2786 if (point.state() == PlatformTouchPoint::TouchPressed) { 2787 2787 m_originatingTouchPointTargets.set(touchPointTargetKey, target); … … 2790 2790 // The target should be the original target for this touch, so get it from the hashmap. As it's a release or cancel 2791 2791 // we also remove it from the map. 2792 touchTarget = m_originatingTouchPointTargets.take(touchPointTargetKey) .get();2792 touchTarget = m_originatingTouchPointTargets.take(touchPointTargetKey); 2793 2793 } else 2794 touchTarget = m_originatingTouchPointTargets.get(touchPointTargetKey) .get();2795 2796 if (!touchTarget )2794 touchTarget = m_originatingTouchPointTargets.get(touchPointTargetKey); 2795 2796 if (!touchTarget.get()) 2797 2797 continue; 2798 2798 2799 RefPtr<Touch> touch = Touch::create(doc->frame(), touchTarget , point.id(),2799 RefPtr<Touch> touch = Touch::create(doc->frame(), touchTarget.get(), point.id(), 2800 2800 point.screenPos().x(), point.screenPos().y(), 2801 2801 adjustedPageX, adjustedPageY);
Note: See TracChangeset
for help on using the changeset viewer.