changeset 288:af37dd280317

Fix: set SCRIPT_CACHE to zero
author Frank Benoit <benoit@tionex.de>
date Thu, 21 Aug 2008 16:08:55 +0200
parents 35d730fb5e9f
children d17d33bea6d0
files dwt/graphics/TextLayout.d
diffstat 1 files changed, 3 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/dwt/graphics/TextLayout.d	Thu Aug 21 09:57:23 2008 +0200
+++ b/dwt/graphics/TextLayout.d	Thu Aug 21 16:08:55 2008 +0200
@@ -2899,18 +2899,16 @@
 bool shape (HDC hdc, StyleItem run, wchar[] wchars, int[] glyphCount, int maxGlyphs, SCRIPT_PROPERTIES* sp) {
     bool useCMAPcheck = !sp.fComplex && !run.analysis.fNoGlyphIndex;
     if (useCMAPcheck) {
-        ushort[] glyphs = new ushort[wchars.length];
+        scope ushort[] glyphs = new ushort[wchars.length];
         if (OS.ScriptGetCMap(hdc, run.psc, wchars.ptr, wchars.length, 0, glyphs.ptr) !is OS.S_OK) {
             if (run.psc !is null) {
                 OS.ScriptFreeCache(run.psc);
                 glyphCount[0] = 0;
                 int[1] one = 1;
-        //        OS.MoveMemory( run.psc, one.ptr, (void*).sizeof );
-        // DWT: FIXME This should be checked, it works in Java with the MoveMemory
+                *cast(int*)run.psc = 0;
             }
             return false;
         }
-        //delete glyphs;
     }
     auto hr = OS.ScriptShape(hdc, run.psc, wchars.ptr, wchars.length, maxGlyphs, &run.analysis, run.glyphs, run.clusters, run.visAttrs, glyphCount.ptr);
     run.glyphCount = glyphCount[0];
@@ -2931,8 +2929,7 @@
     if (run.psc !is null) {
         OS.ScriptFreeCache(run.psc);
         glyphCount[0] = 0;
-        int[1] one = 1;
-        OS.MoveMemory( run.psc, one.ptr, (void*).sizeof );
+        *cast(int*)run.psc = 0;
     }
     run.glyphCount = 0;
     return false;