summaryrefslogtreecommitdiffstats
path: root/WebCore
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2010-05-06 12:35:44 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2010-05-06 12:35:44 -0700
commitec3661418dd6a5edfca19848a0fa12a28959bd06 (patch)
tree93619ae7c81f6254221f2add399d31b0179d3326 /WebCore
parentcc7f27228a13f253de0651478d67245e240a9dc6 (diff)
parent7f034a1734d634dd1fdb3b64817d5828b5e46922 (diff)
downloadexternal_webkit-ec3661418dd6a5edfca19848a0fa12a28959bd06.zip
external_webkit-ec3661418dd6a5edfca19848a0fa12a28959bd06.tar.gz
external_webkit-ec3661418dd6a5edfca19848a0fa12a28959bd06.tar.bz2
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 destroyed it
Merge commit '7f034a1734d634dd1fdb3b64817d5828b5e46922' into froyo-plus-aosp * commit '7f034a1734d634dd1fdb3b64817d5828b5e46922': 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.cpp10
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);