Bug 411875 Kotoeri (Japanese IM) crashes when using Firefox on Mac OS X (10.5.*) r=josh, sr=roc, a1.9=beltzner

This commit is contained in:
masayuki%d-toybox.com 2008-04-22 03:30:45 +00:00
Родитель 391d55f5a1
Коммит d1347e3e38
1 изменённых файлов: 14 добавлений и 14 удалений

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

@ -4217,7 +4217,6 @@ static PRBool IsNormalCharInputtingEvent(const nsKeyEvent& aEvent)
#endif
nsAutoRetainCocoaObject kungFuDeathGrip(self);
id arp = [[NSAutoreleasePool alloc] init];
if (![aString isKindOfClass:[NSAttributedString class]])
aString = [[[NSAttributedString alloc] initWithString:aString] autorelease];
@ -4241,7 +4240,7 @@ static PRBool IsNormalCharInputtingEvent(const nsKeyEvent& aEvent)
mMarkedRange.length = len;
if (!nsTSMManager::IsComposing()) {
if (!nsTSMManager::IsComposing() && len > 0) {
nsQueryContentEvent selection(PR_TRUE, NS_QUERY_SELECTED_TEXT, mGeckoChild);
mGeckoChild->DispatchWindowEvent(selection);
mMarkedRange.location = selection.mSucceeded ? selection.mReply.mOffset : 0;
@ -4251,24 +4250,25 @@ static PRBool IsNormalCharInputtingEvent(const nsKeyEvent& aEvent)
// Note: mGeckoChild might have become null here. Don't count on it from here on.
}
nsTSMManager::UpdateComposing(tmpStr);
if (nsTSMManager::IsComposing()) {
nsTSMManager::UpdateComposing(tmpStr);
[self sendTextEvent:bufPtr attributedString:aString
selectedRange:selRange
markedRange:mMarkedRange
doCommit:NO];
// Note: mGeckoChild might have become null here. Don't count on it from here on.
if (nsTSMManager::IsComposing() && len == 0) {
nsTSMManager::CommitIME();
BOOL commit = len == 0;
[self sendTextEvent:bufPtr attributedString:aString
selectedRange:selRange
markedRange:mMarkedRange
doCommit:commit];
// Note: mGeckoChild might have become null here. Don't count on it from here on.
if (commit) {
[self sendCompositionEvent:NS_COMPOSITION_END];
nsTSMManager::EndComposing();
}
}
if (bufPtr != buffer)
delete[] bufPtr;
[arp release];
NS_OBJC_END_TRY_ABORT_BLOCK;
}