Title: [220124] trunk/Source/WebCore
Revision
220124
Author
[email protected]
Date
2017-08-01 23:40:39 -0700 (Tue, 01 Aug 2017)

Log Message

CFString leak dragging an image - allocation under PlatformPasteboard::writeObjectRepresentations
https://bugs.webkit.org/show_bug.cgi?id=175064

Patch by Joseph Pecoraro <[email protected]> on 2017-08-01
Reviewed by Tim Horton.

* platform/ios/PlatformPasteboardIOS.mm:
(WebCore::PlatformPasteboard::writeObjectRepresentations):
Adopt a created string into the RetainPtr.

* platform/ios/WebItemProviderPasteboard.h:
* platform/ios/WebItemProviderPasteboard.mm:
(-[WebItemProviderRegistrationInfoList dealloc]):
Release suggestedName and switch from -strong to -copy.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (220123 => 220124)


--- trunk/Source/WebCore/ChangeLog	2017-08-02 06:36:55 UTC (rev 220123)
+++ trunk/Source/WebCore/ChangeLog	2017-08-02 06:40:39 UTC (rev 220124)
@@ -1,3 +1,19 @@
+2017-08-01  Joseph Pecoraro  <[email protected]>
+
+        CFString leak dragging an image - allocation under PlatformPasteboard::writeObjectRepresentations
+        https://bugs.webkit.org/show_bug.cgi?id=175064
+
+        Reviewed by Tim Horton.
+
+        * platform/ios/PlatformPasteboardIOS.mm:
+        (WebCore::PlatformPasteboard::writeObjectRepresentations):
+        Adopt a created string into the RetainPtr.
+
+        * platform/ios/WebItemProviderPasteboard.h:
+        * platform/ios/WebItemProviderPasteboard.mm:
+        (-[WebItemProviderRegistrationInfoList dealloc]):
+        Release suggestedName and switch from -strong to -copy.
+
 2017-08-01  Chris Dumez  <[email protected]>
 
         Unreviewed, update Beacon API status to "In Development".

Modified: trunk/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm (220123 => 220124)


--- trunk/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm	2017-08-02 06:36:55 UTC (rev 220123)
+++ trunk/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm	2017-08-02 06:40:39 UTC (rev 220124)
@@ -295,7 +295,7 @@
     if (pasteboardImage.resourceData && !pasteboardImage.resourceMIMEType.isEmpty()) {
         auto utiOrMIMEType = pasteboardImage.resourceMIMEType.createCFString();
         if (!UTTypeIsDeclared(utiOrMIMEType.get()))
-            utiOrMIMEType = UTTypeCreatePreferredIdentifierForTag(kUTTagClassMIMEType, utiOrMIMEType.get(), nil);
+            utiOrMIMEType = adoptCF(UTTypeCreatePreferredIdentifierForTag(kUTTagClassMIMEType, utiOrMIMEType.get(), nil));
 
         auto imageData = pasteboardImage.resourceData->createNSData();
         [itemsToRegister addData:imageData.get() forType:(NSString *)utiOrMIMEType.get()];

Modified: trunk/Source/WebCore/platform/ios/WebItemProviderPasteboard.h (220123 => 220124)


--- trunk/Source/WebCore/platform/ios/WebItemProviderPasteboard.h	2017-08-02 06:36:55 UTC (rev 220123)
+++ trunk/Source/WebCore/platform/ios/WebItemProviderPasteboard.h	2017-08-02 06:40:39 UTC (rev 220124)
@@ -61,7 +61,7 @@
 - (void)addData:(NSData *)data forType:(NSString *)typeIdentifier;
 
 @property (nonatomic) CGSize estimatedDisplayedSize;
-@property (nonatomic, strong) NSString *suggestedName;
+@property (nonatomic, copy) NSString *suggestedName;
 
 - (NSUInteger)numberOfItems;
 - (nullable WebItemProviderRegistrationInfo *)itemAtIndex:(NSUInteger)index;

Modified: trunk/Source/WebCore/platform/ios/WebItemProviderPasteboard.mm (220123 => 220124)


--- trunk/Source/WebCore/platform/ios/WebItemProviderPasteboard.mm	2017-08-02 06:36:55 UTC (rev 220123)
+++ trunk/Source/WebCore/platform/ios/WebItemProviderPasteboard.mm	2017-08-02 06:40:39 UTC (rev 220124)
@@ -116,6 +116,12 @@
     return self;
 }
 
+- (void)dealloc
+{
+    [_suggestedName release];
+    [super dealloc];
+}
+
 - (void)addData:(NSData *)data forType:(NSString *)typeIdentifier
 {
     [_items addObject:[[[WebItemProviderRegistrationInfo alloc] initWithRepresentingObject:nil typeIdentifier:typeIdentifier data:data] autorelease]];
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to