提交 70c77552 编写于 作者: cocos2d-lua.org's avatar cocos2d-lua.org

mac console windows 内存泄漏fix。

上级 eab9dc09
......@@ -38,7 +38,7 @@
{
NSFont *font = [NSFont fontWithName:@"Monaco" size:12.0];
NSDictionary *attrsDictionary = [NSDictionary dictionaryWithObject:font forKey:NSFontAttributeName];
NSAttributedString *string = [[NSAttributedString alloc] initWithString:msg attributes:attrsDictionary];
NSAttributedString *string = [[[NSAttributedString alloc] initWithString:msg attributes:attrsDictionary] autorelease];
NSNumber *len = [NSNumber numberWithUnsignedInteger:[string length]];
[linesCount addObject:len];
......
......@@ -7,7 +7,6 @@
IBOutlet NSButton *checkScroll;
IBOutlet NSButton *topCheckBox;
NSMutableArray *linesCount;
NSUInteger traceCount;
}
@property (assign) IBOutlet NSTextView *textView;
......
......@@ -5,8 +5,6 @@
@end
#define SKIP_LINES_COUNT 3
#define MAX_LINE_LEN 4096
#define MAX_LINES_COUNT 200
@implementation ConsoleWindowController
......@@ -38,14 +36,9 @@
- (void) trace:(NSString*)msg
{
if (traceCount >= SKIP_LINES_COUNT && [msg length] > MAX_LINE_LEN)
{
msg = [NSString stringWithFormat:@"%@ ...", [msg substringToIndex:MAX_LINE_LEN - 4]];
}
traceCount++;
NSFont *font = [NSFont fontWithName:@"Monaco" size:12.0];
NSDictionary *attrsDictionary = [NSDictionary dictionaryWithObject:font forKey:NSFontAttributeName];
NSAttributedString *string = [[NSAttributedString alloc] initWithString:msg attributes:attrsDictionary];
NSAttributedString *string = [[[NSAttributedString alloc] initWithString:msg attributes:attrsDictionary] autorelease];
NSNumber *len = [NSNumber numberWithUnsignedInteger:[string length]];
[linesCount addObject:len];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册