September 01, 2008 Re: dwt learning question,please help | ||||
---|---|---|---|---|
| ||||
Posted in reply to Denis Koroskin | Denis Koroskin Wrote: > On Mon, 01 Sep 2008 12:37:31 +0400, Denis Koroskin <2korden@gmail.com> wrote: > > > On Mon, 01 Sep 2008 11:32:36 +0400, Frank Benoit <keinfarbton@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 |
September 01, 2008 Re: dwt learning question,please help | ||||
---|---|---|---|---|
| ||||
Posted in reply to Frank Benoit | Frank Benoit schrieb:
> this code works for me.
> I will install SP3 to see if i can reproduce the problem.
Works also with SP3 on my WinXp
|
September 01, 2008 Re: dwt learning question,please help | ||||
---|---|---|---|---|
| ||||
Posted in reply to Frank Benoit | On Mon, 01 Sep 2008 16:21:12 +0400, Frank Benoit <keinfarbton@googlemail.com> wrote:
> Denis Koroskin Wrote:
>
>> On Mon, 01 Sep 2008 12:37:31 +0400, Denis Koroskin <2korden@gmail.com>
>> wrote:
>>
>> > On Mon, 01 Sep 2008 11:32:36 +0400, Frank Benoit
>> > <keinfarbton@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.
|
September 01, 2008 Re: dwt learning question,please help | ||||
---|---|---|---|---|
| ||||
Posted in reply to Denis Koroskin | Denis Koroskin schrieb:
> On Mon, 01 Sep 2008 16:21:12 +0400, Frank Benoit <keinfarbton@googlemail.com> wrote:
>
>> Denis Koroskin Wrote:
>>
>>> On Mon, 01 Sep 2008 12:37:31 +0400, Denis Koroskin <2korden@gmail.com> wrote:
>>>
>>> > On Mon, 01 Sep 2008 11:32:36 +0400, Frank Benoit <keinfarbton@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.
you mean
colorPalette.Count == palette.Entries.length
?
I think this is not true. It would be true if Entries would be an dynamic array. But it is static array, hence the length is always 1. But the real array /can/ be longer.
struct ColorPalette {
int Flags;
int Count;
int[1] Entries;
}
To avoid the array bounds check i changed the code to use the pointer arithmetic.
Does that make sense?
|
September 02, 2008 Re: dwt learning question,please help | ||||
---|---|---|---|---|
| ||||
Posted in reply to Frank Benoit | On Tue, 02 Sep 2008 02:24:20 +0400, Frank Benoit <keinfarbton@googlemail.com> wrote: > Denis Koroskin schrieb: >> On Mon, 01 Sep 2008 16:21:12 +0400, Frank Benoit >> <keinfarbton@googlemail.com> wrote: >> >>> Denis Koroskin Wrote: >>> >>>> On Mon, 01 Sep 2008 12:37:31 +0400, Denis Koroskin <2korden@gmail.com> >>>> wrote: >>>> >>>> > On Mon, 01 Sep 2008 11:32:36 +0400, Frank Benoit >>>> > <keinfarbton@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. > > you mean > colorPalette.Count == palette.Entries.length > ? Yes, that was a typo. > > I think this is not true. It would be true if Entries would be an > dynamic array. But it is static array, hence the length is always 1. > But the real array /can/ be longer. > > struct ColorPalette { > int Flags; > int Count; > int[1] Entries; > } > > To avoid the array bounds check i changed the code to use the pointer > arithmetic. > > Does that make sense? Ah, now yes. Thank you for explanation! |
September 05, 2008 Re: dwt learning question,please help | ||||
---|---|---|---|---|
| ||||
Posted in reply to Denis Koroskin | Hi Frank, I tried the same code in Jave(of course it need some slight change) it works fine while it is an Array bounds out of index exception in D. Regards, Sam |
September 05, 2008 Re: dwt learning question,please help | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sam Hu | Sam Hu schrieb:
> Hi Frank,
>
> I tried the same code in Jave(of course it need some slight change) it works fine while it is an Array bounds out of index exception in D.
>
> Regards,
> Sam
Sam Hu
I fixed one problem with array bounds exception. After that i could
never reproduce the problem you have.
Perhaps someone else will report the same problem with another hint how
to reproduce.
Can you use a PNG as a workaround?
Frank
|
September 08, 2008 Re: dwt learning question,please help | ||||
---|---|---|---|---|
| ||||
Posted in reply to Frank Benoit | Hi Frank, When I change to a png image,it works and it seems everything is fine! So what can I learn from it? Thanks, Sam |
September 08, 2008 Re: dwt learning question,please help | ||||
---|---|---|---|---|
| ||||
Posted in reply to Frank Benoit | Hi Frank, When I change to a png image,it works and it seems everything is fine! So what can I learn from it? Thanks, Sam |
September 08, 2008 Re: dwt learning question,please help | ||||
---|---|---|---|---|
| ||||
Posted in reply to Denis Koroskin | On Tue, 02 Sep 2008 01:50:49 +0400, Denis Koroskin <2korden@gmail.com> wrote:
> On Mon, 01 Sep 2008 16:21:12 +0400, Frank Benoit <keinfarbton@googlemail.com> wrote:
>
>> Denis Koroskin Wrote:
>>
>>> On Mon, 01 Sep 2008 12:37:31 +0400, Denis Koroskin <2korden@gmail.com>
>>> wrote:
>>>
>>> > On Mon, 01 Sep 2008 11:32:36 +0400, Frank Benoit
>>> > <keinfarbton@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)
|
Copyright © 1999-2021 by the D Language Foundation