diff options
author | Felipe Heidrich <fheidric> | 2010-09-10 14:16:50 +0000 |
---|---|---|
committer | Felipe Heidrich <fheidric> | 2010-09-10 14:16:50 +0000 |
commit | b9c88a46234c36d57734fc7712ad675ac3274189 (patch) | |
tree | c04b6e8b5c10a2f0440fda1cae1be1862eb838d5 | |
parent | ded72c2d609ae081132418aa96130aa2cfc76aa5 (diff) | |
download | eclipse.platform.swt-b9c88a46234c36d57734fc7712ad675ac3274189.tar.gz eclipse.platform.swt-b9c88a46234c36d57734fc7712ad675ac3274189.tar.xz eclipse.platform.swt-b9c88a46234c36d57734fc7712ad675ac3274189.zip |
BACKPORT Bug 239477 - Crash in ScriptStringOutv3453iRoot_PatchFor_3_4_maintenance
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java index e365bc3a19..de7fb74bce 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/TextLayout.java @@ -2774,7 +2774,13 @@ void shape (final int /*long*/ hdc, final StyleItem run) { int /*long*/ metaFileDc = OS.CreateEnhMetaFile(hdc, null, null, null); int /*long*/ oldMetaFont = OS.SelectObject(metaFileDc, hFont); int flags = OS.SSA_METAFILE | OS.SSA_FALLBACK | OS.SSA_GLYPHS | OS.SSA_LINK; - if (OS.ScriptStringAnalyse(metaFileDc, chars, chars.length, 0, -1, flags, 0, null, null, 0, 0, 0, ssa) == OS.S_OK) { + /* + * Bug in Uniscribe. In some version of Uniscribe, ScriptStringAnalyse crashes + * when the character array is too long. The fix is to limit the size of character + * array to two. Note, limiting the array to only one character would cause surrogate + * pairs to stop working. + */ + if (OS.ScriptStringAnalyse(metaFileDc, chars, Math.min(chars.length, 2), 0, -1, flags, 0, null, null, 0, 0, 0, ssa) == OS.S_OK) { OS.ScriptStringOut(ssa, 0, 0, 0, null, 0, 0, false); OS.ScriptStringFree(ssa); } |