summaryrefslogtreecommitdiffstats
path: root/webkit/glue
diff options
context:
space:
mode:
authorjamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-10 06:48:45 +0000
committerjamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-10 06:48:45 +0000
commit002de2f6f5aa1287b779c178f39dd112861b9c69 (patch)
tree84af5dbf408d7c410560e2cdd73963e0ea9317ac /webkit/glue
parent1dd862554bb698ac52a92539bf8b676ac664dff0 (diff)
downloadchromium_src-002de2f6f5aa1287b779c178f39dd112861b9c69.zip
chromium_src-002de2f6f5aa1287b779c178f39dd112861b9c69.tar.gz
chromium_src-002de2f6f5aa1287b779c178f39dd112861b9c69.tar.bz2
Fix member variable order in WebGestureCurve implementations
The call to scrollBy() can result in the curve going away, so it's unsafe to touch member variables after making the call. Covered by webkit_unit_tests. BUG=169156 Review URL: https://chromiumcodereview.appspot.com/11778080 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@176037 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue')
-rw-r--r--webkit/glue/fling_animator_impl_android.cc4
-rw-r--r--webkit/glue/touch_fling_gesture_curve.cc2
2 files changed, 5 insertions, 1 deletions
diff --git a/webkit/glue/fling_animator_impl_android.cc b/webkit/glue/fling_animator_impl_android.cc
index b4ba447..bac4e91 100644
--- a/webkit/glue/fling_animator_impl_android.cc
+++ b/webkit/glue/fling_animator_impl_android.cc
@@ -107,9 +107,11 @@ bool FlingAnimatorImpl::apply(double time,
gfx::Point current_position = GetCurrentPosition();
gfx::Vector2d diff(current_position - last_position_);
+ last_position_ = current_position;
WebKit::WebPoint scroll_amount(diff.x(), diff.y());
+ // scrollBy() could delete this curve if the animation is over, so don't touch
+ // any member variables after making that call.
target->scrollBy(scroll_amount);
- last_position_ = current_position;
return true;
}
diff --git a/webkit/glue/touch_fling_gesture_curve.cc b/webkit/glue/touch_fling_gesture_curve.cc
index d33a689..523500d 100644
--- a/webkit/glue/touch_fling_gesture_curve.cc
+++ b/webkit/glue/touch_fling_gesture_curve.cc
@@ -165,6 +165,8 @@ bool TouchFlingGestureCurve::apply(double time, WebGestureCurveTarget* target) {
cumulative_scroll_ = WebSize(scroll.x, scroll.y);
if (time + time_offset_ < curve_duration_ || scroll_increment != WebPoint()) {
+ // scrollBy() could delete this curve if the animation is over, so don't
+ // touch any member variables after making that call.
target->scrollBy(scroll_increment);
return true;
}