diff options
author | Ben Murdoch <benm@google.com> | 2010-05-06 12:44:09 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2010-05-06 12:44:09 -0700 |
commit | bf13d116b8b9dbefaf2a09542aaad63f85cc16d4 (patch) | |
tree | 24e7e7ed4e399058ca8c7c90bba2b03016578f9f /WebCore | |
parent | 4190ab2847d07e62176dda30b40d24218e3fb505 (diff) | |
parent | ec3661418dd6a5edfca19848a0fa12a28959bd06 (diff) | |
download | external_webkit-bf13d116b8b9dbefaf2a09542aaad63f85cc16d4.zip external_webkit-bf13d116b8b9dbefaf2a09542aaad63f85cc16d4.tar.gz external_webkit-bf13d116b8b9dbefaf2a09542aaad63f85cc16d4.tar.bz2 |
am ec366141: am 7f034a17: Fix a ref counting bug in touch event handling. The RefPtr returned from m_originatingTouchPointTargets.take() was only in scope for the duration of the else block but we saved the raw pointer it wrapped. When the else block ended, the RefPtr
Merge commit 'ec3661418dd6a5edfca19848a0fa12a28959bd06' into kraken
* commit 'ec3661418dd6a5edfca19848a0fa12a28959bd06':
Fix a ref counting bug in touch event handling. The RefPtr returned from m_originatingTouchPointTargets.take() was only in scope
Diffstat (limited to 'WebCore')
-rw-r--r-- | WebCore/page/EventHandler.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/WebCore/page/EventHandler.cpp b/WebCore/page/EventHandler.cpp index 5904934..2e07b6a 100644 --- a/WebCore/page/EventHandler.cpp +++ b/WebCore/page/EventHandler.cpp @@ -2602,21 +2602,21 @@ bool EventHandler::handleTouchEvent(const PlatformTouchEvent& event) // Increment the platform touch id by 1 to avoid storing a key of 0 in the hashmap. unsigned touchPointTargetKey = point.id() + 1; - EventTarget* touchTarget = 0; + RefPtr<EventTarget> touchTarget; if (point.state() == PlatformTouchPoint::TouchPressed) { m_originatingTouchPointTargets.set(touchPointTargetKey, target); touchTarget = target; } else if (point.state() == PlatformTouchPoint::TouchReleased || point.state() == PlatformTouchPoint::TouchCancelled) { // The target should be the original target for this touch, so get it from the hashmap. As it's a release or cancel // we also remove it from the map. - touchTarget = m_originatingTouchPointTargets.take(touchPointTargetKey).get(); + touchTarget = m_originatingTouchPointTargets.take(touchPointTargetKey); } else - touchTarget = m_originatingTouchPointTargets.get(touchPointTargetKey).get(); + touchTarget = m_originatingTouchPointTargets.get(touchPointTargetKey); - if (!touchTarget) + if (!touchTarget.get()) continue; - RefPtr<Touch> touch = Touch::create(doc->frame(), touchTarget, point.id(), + RefPtr<Touch> touch = Touch::create(doc->frame(), touchTarget.get(), point.id(), point.screenPos().x(), point.screenPos().y(), adjustedPageX, adjustedPageY); |