From 6121818f85149e5798d6906101203a60192528e0 Mon Sep 17 00:00:00 2001 From: John Daggett Date: Fri, 26 Sep 2008 16:51:53 +0900 Subject: [PATCH] Bug 436663. Work around ATSUI crasher caused by long Hebrew sequence. r=roc, sr=vlad --- gfx/thebes/src/gfxAtsuiFonts.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/gfx/thebes/src/gfxAtsuiFonts.cpp b/gfx/thebes/src/gfxAtsuiFonts.cpp index de5c665c8..d73eb80c3 100644 --- a/gfx/thebes/src/gfxAtsuiFonts.cpp +++ b/gfx/thebes/src/gfxAtsuiFonts.cpp @@ -62,7 +62,7 @@ #include "nsUnicodeRange.h" // Uncomment this to dump all text runs created to stdout -#define DUMP_TEXT_RUNS +// #define DUMP_TEXT_RUNS #ifdef DUMP_TEXT_RUNS static PRLogModuleInfo *gAtsuiTextRunLog = PR_NewLogModule("atsuiTextRun"); @@ -694,7 +694,16 @@ gfxAtsuiFontGroup::GuessMaximumStringLength() // but we need to be a bit careful to avoid math errors. PRUint32 maxAdvance = PRUint32(GetFontAt(0)->GetMetrics().maxAdvance); PRUint32 chars = 0x7FFF/PR_MAX(1, maxAdvance); - return PR_MAX(1, chars); + + PRUint32 realGuessMax = PR_MAX(1, chars); + + // bug 436663 - ATSUI crashes on 10.5.3 with certain character sequences + // at around 512 characters, so for safety sake max out at 500 characters + if (gfxPlatformMac::GetPlatform()->OSXVersion() >= MAC_OS_X_VERSION_10_5_HEX) { + realGuessMax = PR_MIN(500, realGuessMax); + } + + return realGuessMax; } /* -- 2.11.4.GIT