Title: [254318] trunk/Tools
Revision
254318
Author
[email protected]
Date
2020-01-09 18:10:18 -0800 (Thu, 09 Jan 2020)

Log Message

TestController::platformLibraryPathForTesting() returns inner pointer to autoreleased NSString
<https://webkit.org/b/206018>
<rdar://problem/58449733>

Reviewed by Darin Adler.

* WebKitTestRunner/TestController.cpp:
(WTR::TestController::initialize):
- Use WTF::AutodrainedPool to fix remaining autoreleasePool
  leaks.
* WebKitTestRunner/ios/TestControllerIOS.mm:
(WTR::TestController::platformLibraryPathForTesting):
* WebKitTestRunner/mac/TestControllerMac.mm:
(WTR::TestController::platformLibraryPathForTesting):
- Retain NSString since these methods return an inner pointer.
  This also only needs to be initialized once.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (254317 => 254318)


--- trunk/Tools/ChangeLog	2020-01-10 01:25:42 UTC (rev 254317)
+++ trunk/Tools/ChangeLog	2020-01-10 02:10:18 UTC (rev 254318)
@@ -1,3 +1,22 @@
+2020-01-09  David Kilzer  <[email protected]>
+
+        TestController::platformLibraryPathForTesting() returns inner pointer to autoreleased NSString
+        <https://webkit.org/b/206018>
+        <rdar://problem/58449733>
+
+        Reviewed by Darin Adler.
+
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::initialize):
+        - Use WTF::AutodrainedPool to fix remaining autoreleasePool
+          leaks.
+        * WebKitTestRunner/ios/TestControllerIOS.mm:
+        (WTR::TestController::platformLibraryPathForTesting):
+        * WebKitTestRunner/mac/TestControllerMac.mm:
+        (WTR::TestController::platformLibraryPathForTesting):
+        - Retain NSString since these methods return an inner pointer.
+          This also only needs to be initialized once.
+
 2020-01-09  Wenson Hsieh  <[email protected]>
 
         Text manipulation controller should not observe changes in new replacement elements

Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (254317 => 254318)


--- trunk/Tools/WebKitTestRunner/TestController.cpp	2020-01-10 01:25:42 UTC (rev 254317)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp	2020-01-10 02:10:18 UTC (rev 254318)
@@ -442,6 +442,8 @@
 
 void TestController::initialize(int argc, const char* argv[])
 {
+    AutodrainedPool pool;
+
     JSC::initializeThreading();
     RunLoop::initializeMainRunLoop();
     WTF::setProcessPrivileges(allPrivileges());

Modified: trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm (254317 => 254318)


--- trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm	2020-01-10 01:25:42 UTC (rev 254317)
+++ trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm	2020-01-10 02:10:18 UTC (rev 254318)
@@ -250,7 +250,12 @@
 
 const char* TestController::platformLibraryPathForTesting()
 {
-    return [[@"~/Library/Application Support/WebKitTestRunner" stringByExpandingTildeInPath] UTF8String];
+    static NSString *platformLibraryPath = nil;
+    static dispatch_once_t onceToken;
+    dispatch_once(&onceToken, ^{
+        platformLibraryPath = [[@"~/Library/Application Support/WebKitTestRunner" stringByExpandingTildeInPath] retain];
+    });
+    return platformLibraryPath.UTF8String;
 }
 
 void TestController::setHidden(bool)

Modified: trunk/Tools/WebKitTestRunner/mac/TestControllerMac.mm (254317 => 254318)


--- trunk/Tools/WebKitTestRunner/mac/TestControllerMac.mm	2020-01-10 01:25:42 UTC (rev 254317)
+++ trunk/Tools/WebKitTestRunner/mac/TestControllerMac.mm	2020-01-10 02:10:18 UTC (rev 254318)
@@ -377,7 +377,12 @@
 
 const char* TestController::platformLibraryPathForTesting()
 {
-    return [[@"~/Library/Application Support/DumpRenderTree" stringByExpandingTildeInPath] UTF8String];
+    static NSString *platformLibraryPath = nil;
+    static dispatch_once_t onceToken;
+    dispatch_once(&onceToken, ^{
+        platformLibraryPath = [[@"~/Library/Application Support/DumpRenderTree" stringByExpandingTildeInPath] retain];
+    });
+    return platformLibraryPath.UTF8String;
 }
 
 } // namespace WTR
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to