dwt learning question,please help

Denis Koroskin 2korden at gmail.com
Mon Sep 8 02:44:29 PDT 2008


On Tue, 02 Sep 2008 01:50:49 +0400, Denis Koroskin <2korden at gmail.com>  
wrote:

> On Mon, 01 Sep 2008 16:21:12 +0400, Frank Benoit  
> <keinfarbton at googlemail.com> wrote:
>
>> Denis Koroskin Wrote:
>>
>>> On Mon, 01 Sep 2008 12:37:31 +0400, Denis Koroskin <2korden at gmail.com>
>>> wrote:
>>>
>>> > On Mon, 01 Sep 2008 11:32:36 +0400, Frank Benoit
>>> > <keinfarbton at googlemail.com> wrote:
>>> >
>>> >> this code works for me.
>>> >> I will install SP3 to see if i can reproduce the problem.
>>> >
>>> > I have the same bug, too. Windows 2003 Server
>>>
>>> More info:
>>>
>>> Tango backtrace hack intiated
>>> Unhandled D exception!
>>> Error: Array index out of bounds
>>> (tango.core.Exception.ArrayBoundsException) in dwt.graphics.Image [715]
>>> backtrace:
>>>   004d5d51 onArrayBoundsError (+25)
>>>   00404087 void resizeapp.MainForm.InitializeComponents(void*) (+67)
>>> resizeapp.d:32
>>>   00404290 class resizeapp.MainForm resizeapp.MainForm._ctor(void*)�  
>>> (+10)
>>> resizeapp.d:79
>>>   004042ab _Dmain (+17) resizeapp.d:86
>>>   004d3041 extern (C) int dmain2.main(int, char**) . void  
>>> runMain(void*)
>>> (+d)
>>>   004df062 mainCRTStartup (+aa)
>>>   77e6f23c ???
>>>   00000001 ???
>>>
>>> 712 RGB[] rgbs = new RGB[colorPalette.Count];
>>> 713 paletteData = new PaletteData(rgbs);
>>> 714 for (int i = 0; i < colorPalette.Count; i++) {
>>> 715     if (((palette.Entries[i] >> 24) & 0xFF) is 0 &&
>>> (colorPalette.Flags & Gdip.PaletteFlagsHasAlpha) !is 0) {
>>> 716         transparentPixel = i;
>>> 717     }
>>> 718     rgbs[i] = new RGB(((palette.Entries[i] & 0xFF0000) >> 16),
>>> ((palette.Entries[i] & 0xFF00) >> 8), ((palette.Entries[i] & 0xFF) >>  
>>> 0));
>>> 719 }
>>> 720 OS.HeapFree(hHeap, 0, palette);
>>> 721 break;
>>
>>
>> This was fixed in
>> http://www.dsource.org/projects/dwt-win/changeset/302%3A555d58850cd9
>> can you please retry with the newest tip version?
>> http://hg.dsource.org/projects/dwt-win/archive/tip.zip
>>
>> Frank
>
> Ouch! Are you sure this fixes the issue and not hides it? It's quite  
> clear that the bug is somewhere else, colorPalette.Count ==  
> palette.Entries should always evaluate to true.

This one still prevents me from sleepping :)

You can use :
palette.Entries.ptr[i]

to prevend array bound checking made by:
palette.Entries[i]

instead of unpleasant:
*(palette.Entries.ptr + i)


More information about the Digitalmars-d-dwt mailing list