Bug 428980 leaking NSAutoreleasePool object in insertText r=josh,sr=vlad, a=beltzner

This commit is contained in:
masayuki%d-toybox.com 2008-04-16 04:56:51 +00:00
Родитель 60ee84b118
Коммит 4b84e34633
1 изменённых файлов: 1 добавлений и 6 удалений

Просмотреть файл

@ -4024,17 +4024,14 @@ static PRBool IsNormalCharInputtingEvent(const nsKeyEvent& aEvent)
return;
nsAutoRetainCocoaObject kungFuDeathGrip(self);
id arp = [[NSAutoreleasePool alloc] init];
if (![insertString isKindOfClass:[NSAttributedString class]])
insertString = [[[NSAttributedString alloc] initWithString:insertString] autorelease];
NSString *tmpStr = [insertString string];
unsigned int len = [tmpStr length];
if (!nsTSMManager::IsComposing() && len == 0) {
[arp release];
if (!nsTSMManager::IsComposing() && len == 0)
return; // nothing to do
}
PRUnichar buffer[MAX_BUFFER_SIZE];
PRUnichar *bufPtr = (len >= MAX_BUFFER_SIZE) ? new PRUnichar[len + 1] : buffer;
[tmpStr getCharacters:bufPtr];
@ -4115,8 +4112,6 @@ static PRBool IsNormalCharInputtingEvent(const nsKeyEvent& aEvent)
if (bufPtr != buffer)
delete[] bufPtr;
[arp release];
NS_OBJC_END_TRY_ABORT_BLOCK;
}