EventSenderProxy::swipeGestureWithWheelAndMomentumPhases() leaks an EventSenderSynthe...
authorddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 2 Dec 2015 01:25:12 +0000 (01:25 +0000)
committerddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 2 Dec 2015 01:25:12 +0000 (01:25 +0000)
<http://webkit.org/b/151726>

Reviewed by Simon Fraser.

* WebKitTestRunner/mac/EventSenderProxy.mm:
(WTR::EventSenderProxy::swipeGestureWithWheelAndMomentumPhases):
Deploy RetainPtr<EventSenderSyntheticEvent> to fix leak.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@192933 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/WebKitTestRunner/mac/EventSenderProxy.mm

index f5b6155..6244edd 100644 (file)
@@ -1,3 +1,14 @@
+2015-12-01  David Kilzer  <ddkilzer@apple.com>
+
+        EventSenderProxy::swipeGestureWithWheelAndMomentumPhases() leaks an EventSenderSyntheticEvent
+        <http://webkit.org/b/151726>
+
+        Reviewed by Simon Fraser.
+
+        * WebKitTestRunner/mac/EventSenderProxy.mm:
+        (WTR::EventSenderProxy::swipeGestureWithWheelAndMomentumPhases):
+        Deploy RetainPtr<EventSenderSyntheticEvent> to fix leak.
+
 2015-12-01  Myles C. Maxfield  <mmaxfield@apple.com>
 
         Give String and AtomicString an existingHash() function
index f7cb728..4cabd97 100644 (file)
@@ -930,7 +930,7 @@ static NSEventPhase nsEventPhaseFromCGEventPhase(int phase)
 
 void EventSenderProxy::swipeGestureWithWheelAndMomentumPhases(int x, int y, int phase, int momentum)
 {
-    EventSenderSyntheticEvent *event = [[EventSenderSyntheticEvent alloc] init];
+    RetainPtr<EventSenderSyntheticEvent> event = adoptNS([[EventSenderSyntheticEvent alloc] init]);
 
     // "mayBegin" a swipe is actually a scroll wheel event.
     event->_eventSender_type = (phase == 128) ? NSScrollWheel : NSEventTypeGesture;
@@ -950,7 +950,7 @@ void EventSenderProxy::swipeGestureWithWheelAndMomentumPhases(int x, int y, int
     NSLog(@"Synthetic swipe gestures are not implemented for 32-bit WebKitTestRunner.");
 #endif
 
-    [NSApp sendEvent:event];
+    [NSApp sendEvent:event.get()];
 }
 
 } // namespace WTR