Title: [249901] trunk/Tools
Revision
249901
Author
[email protected]
Date
2019-09-16 09:26:53 -0700 (Mon, 16 Sep 2019)

Log Message

Fix leaks in DumpRenderTree and WebKitTestRunner
<https://webkit.org/b/201814>

Reviewed by Darin Adler.

* DumpRenderTree/TestNetscapePlugIn/PluginObject.h:
(createCoreAnimationLayer): Fix signature to return CFTypeRef.
Add CF_RETURNS_RETAINED to document behavior.
* DumpRenderTree/TestNetscapePlugIn/PluginObjectMac.mm:
(createCoreAnimationLayer): Fix signature to return CFTypeRef.

* DumpRenderTree/mac/PixelDumpSupportMac.mm:
(takeWindowSnapshot): Add CF_RETURNS_RETAINED to document
behavior.
(createBitmapContextFromWebView): Fix leak of CGImageRef when
generating a replacement image.

* WebKitTestRunner/cocoa/TestRunnerWKWebView.mm: Add @dynamic
declaration for _stableStateOverride so compiler wouldn't try to
create another instance variable for it.

* WebKitTestRunner/mac/EventSenderProxy.mm:
(-[EventSenderSyntheticEvent initPressureEventAtLocation:globalLocation:stage:pressure:stageTransition:phase:time:eventNumber:window:]):
Release `cgEvent` to fix leak.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (249900 => 249901)


--- trunk/Tools/ChangeLog	2019-09-16 16:11:57 UTC (rev 249900)
+++ trunk/Tools/ChangeLog	2019-09-16 16:26:53 UTC (rev 249901)
@@ -1,3 +1,30 @@
+2019-09-16  David Kilzer  <[email protected]>
+
+        Fix leaks in DumpRenderTree and WebKitTestRunner
+        <https://webkit.org/b/201814>
+
+        Reviewed by Darin Adler.
+
+        * DumpRenderTree/TestNetscapePlugIn/PluginObject.h:
+        (createCoreAnimationLayer): Fix signature to return CFTypeRef.
+        Add CF_RETURNS_RETAINED to document behavior.
+        * DumpRenderTree/TestNetscapePlugIn/PluginObjectMac.mm:
+        (createCoreAnimationLayer): Fix signature to return CFTypeRef.
+
+        * DumpRenderTree/mac/PixelDumpSupportMac.mm:
+        (takeWindowSnapshot): Add CF_RETURNS_RETAINED to document
+        behavior.
+        (createBitmapContextFromWebView): Fix leak of CGImageRef when
+        generating a replacement image.
+
+        * WebKitTestRunner/cocoa/TestRunnerWKWebView.mm: Add @dynamic
+        declaration for _stableStateOverride so compiler wouldn't try to
+        create another instance variable for it.
+
+        * WebKitTestRunner/mac/EventSenderProxy.mm:
+        (-[EventSenderSyntheticEvent initPressureEventAtLocation:globalLocation:stage:pressure:stageTransition:phase:time:eventNumber:window:]):
+        Release `cgEvent` to fix leak.
+
 2019-09-16  Andres Gonzalez  <[email protected]>
 
         Expose misspelling ranges for editable content to accessibility clients.

Modified: trunk/Tools/DumpRenderTree/TestNetscapePlugIn/PluginObject.h (249900 => 249901)


--- trunk/Tools/DumpRenderTree/TestNetscapePlugIn/PluginObject.h	2019-09-16 16:11:57 UTC (rev 249900)
+++ trunk/Tools/DumpRenderTree/TestNetscapePlugIn/PluginObject.h	2019-09-16 16:26:53 UTC (rev 249901)
@@ -83,7 +83,7 @@
 extern bool testWindowOpen(NPP npp);
 
 #ifdef XP_MACOSX
-extern const void* createCoreAnimationLayer();
+extern CFTypeRef createCoreAnimationLayer() CF_RETURNS_RETAINED;
 #endif
 
 #endif

Modified: trunk/Tools/DumpRenderTree/TestNetscapePlugIn/PluginObjectMac.mm (249900 => 249901)


--- trunk/Tools/DumpRenderTree/TestNetscapePlugIn/PluginObjectMac.mm	2019-09-16 16:11:57 UTC (rev 249900)
+++ trunk/Tools/DumpRenderTree/TestNetscapePlugIn/PluginObjectMac.mm	2019-09-16 16:26:53 UTC (rev 249901)
@@ -42,7 +42,7 @@
 
 @end
 
-const void* createCoreAnimationLayer()
+CFTypeRef createCoreAnimationLayer()
 {
     CALayer *caLayer = [[TestPluginLayer alloc] init];
 

Modified: trunk/Tools/DumpRenderTree/mac/PixelDumpSupportMac.mm (249900 => 249901)


--- trunk/Tools/DumpRenderTree/mac/PixelDumpSupportMac.mm	2019-09-16 16:11:57 UTC (rev 249900)
+++ trunk/Tools/DumpRenderTree/mac/PixelDumpSupportMac.mm	2019-09-16 16:26:53 UTC (rev 249901)
@@ -83,7 +83,7 @@
     CGContextRestoreGState(context);
 }
 
-static CGImageRef takeWindowSnapshot(CGSWindowID windowID, CGWindowImageOption imageOptions)
+static CGImageRef takeWindowSnapshot(CGSWindowID windowID, CGWindowImageOption imageOptions) CF_RETURNS_RETAINED
 {
     imageOptions |= kCGWindowImageBoundsIgnoreFraming | kCGWindowImageShouldBeOpaque;
     return CGWindowListCreateImage(CGRectNull, kCGWindowListOptionIncludingWindow, windowID, imageOptions);
@@ -141,8 +141,10 @@
             if (image) {
                 // Work around <rdar://problem/17084993>; re-request the snapshot at kCGWindowImageNominalResolution if it was captured at the wrong scale.
                 CGFloat desiredSnapshotWidth = window.frame.size.width * deviceScaleFactor;
-                if (CGImageGetWidth(image) != desiredSnapshotWidth)
+                if (CGImageGetWidth(image) != desiredSnapshotWidth) {
+                    CGImageRelease(image);
                     image = takeWindowSnapshot([window windowNumber], kCGWindowImageNominalResolution);
+                }
             }
 
             if (!image)

Modified: trunk/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.mm (249900 => 249901)


--- trunk/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.mm	2019-09-16 16:11:57 UTC (rev 249900)
+++ trunk/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.mm	2019-09-16 16:26:53 UTC (rev 249901)
@@ -72,6 +72,8 @@
 
 @implementation TestRunnerWKWebView
 
+@dynamic _stableStateOverride;
+
 #if PLATFORM(MAC)
 IGNORE_WARNINGS_BEGIN("deprecated-implementations")
 - (void)dragImage:(NSImage *)anImage at:(NSPoint)viewLocation offset:(NSSize)initialOffset event:(NSEvent *)event pasteboard:(NSPasteboard *)pboard source:(id)sourceObj slideBack:(BOOL)slideFlag

Modified: trunk/Tools/WebKitTestRunner/mac/EventSenderProxy.mm (249900 => 249901)


--- trunk/Tools/WebKitTestRunner/mac/EventSenderProxy.mm	2019-09-16 16:11:57 UTC (rev 249900)
+++ trunk/Tools/WebKitTestRunner/mac/EventSenderProxy.mm	2019-09-16 16:26:53 UTC (rev 249901)
@@ -105,6 +105,7 @@
     CGEventSetIntegerValueField(cgEvent, kCGEventGestureBehavior, kCGSGestureBehaviorDeepPress);
 
     self = [super _initWithCGEvent:cgEvent eventRef:nullptr];
+    CFRelease(cgEvent);
 
     if (!self)
         return nil;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to