Bug 753665 - Add some missing kungFuDeathGrips while dispatching events. r=blassey
authorKartikaya Gupta <kgupta@mozilla.com>
Sat, 26 May 2012 11:06:55 -0400
changeset 95051 20a421502a41c9c8c2f9c8c42bef2922d429b2ce
parent 95050 88787676b14a19cf8f5124407fa5e2c8a27ef604
child 95052 a8cc00d4ca483c1978cae5a8dcf5a8ae49e8cc72
push id22774
push userryanvm@gmail.com
push dateSat, 26 May 2012 22:21:30 +0000
treeherdermozilla-central@c2dcd002556b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersblassey
bugs753665
milestone15.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 753665 - Add some missing kungFuDeathGrips while dispatching events. r=blassey
widget/android/nsWindow.cpp
--- a/widget/android/nsWindow.cpp
+++ b/widget/android/nsWindow.cpp
@@ -1305,16 +1305,18 @@ nsWindow::OnMotionEvent(AndroidGeckoEven
         case AndroidMotionEvent::ACTION_CANCEL:
             msg = NS_MOUSE_BUTTON_UP;
             break;
 
         default:
             return;
     }
 
+    nsRefPtr<nsWindow> kungFuDeathGrip(this);
+
 send_again:
 
     nsMouseEvent event(true,
                        msg, this,
                        nsMouseEvent::eReal, nsMouseEvent::eNormal);
     // XXX can we synthesize different buttons?
     event.button = nsMouseEvent::eLeftButton;
 
@@ -1338,16 +1340,18 @@ getDistance(const nsIntPoint &p1, const 
 {
     double deltaX = p2.x - p1.x;
     double deltaY = p2.y - p1.y;
     return sqrt(deltaX*deltaX + deltaY*deltaY);
 }
 
 bool nsWindow::OnMultitouchEvent(AndroidGeckoEvent *ae)
 {
+    nsRefPtr<nsWindow> kungFuDeathGrip(this);
+
     // This is set to true once we have called SetPreventPanning() exactly
     // once for a given sequence of touch events. It is reset on the start
     // of the next sequence.
     static bool sDefaultPreventedNotified = false;
     static bool sLastWasDownEvent = false;
 
     bool preventDefaultActions = false;
     bool isDownEvent = false;