[Mac] RetainPtr member cleanup, possible leaks
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 15 Feb 2015 05:14:31 +0000 (05:14 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 15 Feb 2015 05:14:31 +0000 (05:14 +0000)
https://bugs.webkit.org/show_bug.cgi?id=141616

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2015-02-14
Reviewed by Andreas Kling.

* platform/mac/PlatformSpeechSynthesizerMac.mm:
(-[WebSpeechSynthesisWrapper speakUtterance:]):
Adopt the allocated object to avoid a possible leak.

* platform/mac/ScrollAnimatorMac.mm:
(WebCore::ScrollAnimatorMac::ScrollAnimatorMac):
Adopt to avoid unnecessary retain/autorelease.

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

Source/WebCore/ChangeLog
Source/WebCore/platform/mac/PlatformSpeechSynthesizerMac.mm
Source/WebCore/platform/mac/ScrollAnimatorMac.mm

index 80acc88..5f7829f 100644 (file)
@@ -1,5 +1,20 @@
 2015-02-14  Joseph Pecoraro  <pecoraro@apple.com>
 
+        [Mac] RetainPtr member cleanup, possible leaks
+        https://bugs.webkit.org/show_bug.cgi?id=141616
+
+        Reviewed by Andreas Kling.
+
+        * platform/mac/PlatformSpeechSynthesizerMac.mm:
+        (-[WebSpeechSynthesisWrapper speakUtterance:]):
+        Adopt the allocated object to avoid a possible leak.
+
+        * platform/mac/ScrollAnimatorMac.mm:
+        (WebCore::ScrollAnimatorMac::ScrollAnimatorMac):
+        Adopt to avoid unnecessary retain/autorelease.
+
+2015-02-14  Joseph Pecoraro  <pecoraro@apple.com>
+
         IncompleteMetaDataCue leak seen on leaks bot
         https://bugs.webkit.org/show_bug.cgi?id=141611
 
index 86e8bc9..868a8e2 100644 (file)
@@ -90,7 +90,7 @@
     ASSERT(utterance);
     
     if (!m_synthesizer) {
-        m_synthesizer = [[NSSpeechSynthesizer alloc] initWithVoice:nil];
+        m_synthesizer = adoptNS([[NSSpeechSynthesizer alloc] initWithVoice:nil]);
         [m_synthesizer setDelegate:self];
     }
     
index 72e04fb..4407623 100644 (file)
@@ -654,7 +654,7 @@ ScrollAnimatorMac::ScrollAnimatorMac(ScrollableArea* scrollableArea)
     m_scrollAnimationHelper = adoptNS([[NSClassFromString(@"NSScrollAnimationHelper") alloc] initWithDelegate:m_scrollAnimationHelperDelegate.get()]);
 
     m_scrollbarPainterControllerDelegate = adoptNS([[WebScrollbarPainterControllerDelegate alloc] initWithScrollableArea:scrollableArea]);
-    m_scrollbarPainterController = [[[NSClassFromString(@"NSScrollerImpPair") alloc] init] autorelease];
+    m_scrollbarPainterController = adoptNS([[NSClassFromString(@"NSScrollerImpPair") alloc] init]);
     [m_scrollbarPainterController setDelegate:(id)m_scrollbarPainterControllerDelegate.get()];
     [m_scrollbarPainterController setScrollerStyle:recommendedScrollerStyle()];
 }