Skip to content
Permalink
Browse files
<http://webkit.org/b/59705> WTF::postTimer() leaks a CFRunLoopTimerRe…
…f every time it's called

Reviewed by Simon Fraser.

* wtf/mac/MainThreadMac.mm:
(WTF::postTimer): Use RetainPtr to plug the leak.

Canonical link: https://commits.webkit.org/74906@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@85195 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
ddkilzer committed Apr 28, 2011
1 parent bd1c5a6 commit 3d2cba9f3d559df93801329d75c48c64a286a20c
Showing with 12 additions and 1 deletion.
  1. +9 −0 Source/JavaScriptCore/ChangeLog
  2. +3 −1 Source/JavaScriptCore/wtf/mac/MainThreadMac.mm
@@ -1,3 +1,12 @@
2011-04-28 David Kilzer <ddkilzer@apple.com>

<http://webkit.org/b/59705> WTF::postTimer() leaks a CFRunLoopTimerRef every time it's called

Reviewed by Simon Fraser.

* wtf/mac/MainThreadMac.mm:
(WTF::postTimer): Use RetainPtr to plug the leak.

2011-04-27 Sam Weinig <sam@webkit.org>

Reviewed by David Kilzer.
@@ -33,6 +33,7 @@
#import <Foundation/NSThread.h>
#import <stdio.h>
#import <wtf/Assertions.h>
#import <wtf/RetainPtr.h>
#import <wtf/Threading.h>

@interface WTFMainThreadCaller : NSObject {
@@ -95,7 +96,8 @@ static void postTimer()
return;

isTimerPosted = true;
CFRunLoopAddTimer(CFRunLoopGetCurrent(), CFRunLoopTimerCreate(0, 0, 0, 0, 0, timerFired, 0), kCFRunLoopCommonModes);
RetainPtr<CFRunLoopTimerRef> runLoopTimer(AdoptCF, CFRunLoopTimerCreate(0, 0, 0, 0, 0, timerFired, 0));
CFRunLoopAddTimer(CFRunLoopGetCurrent(), runLoopTimer.get(), kCFRunLoopCommonModes);
}

void scheduleDispatchFunctionsOnMainThread()

0 comments on commit 3d2cba9

Please sign in to comment.