dwt-addons rework, please test

Frank Benoit keinfarbton at googlemail.com
Fri Aug 8 06:21:51 PDT 2008


yidabu schrieb:
> On Fri, 08 Aug 2008 11:32:13 +0200
> Frank Benoit <keinfarbton at googlemail.com> wrote:
> 
>  
>> Are you sure, the imageManager return the Images as non-null?
>> This would explain the invalid arg exception.
> 
> your are right, the image is null now. but the same code works fine before, causes exception after upgrade to dwtx svn.
> 
> perhaps this is an ImageRegistry issue?
> 
> I'm sure the Images -JPath is right(have not compile error, and works fine before).
> 
> 
> 
> import dwtx.jface.resource.ImageDescriptor;
> import dwtx.jface.resource.ImageRegistry;
> 
> import dwt.graphics.Image;
> import dwt.graphics.ImageData;
> 
> import dwt.widgets.Display;
> import dwt.dwthelper.utils;
> 
> public class ImageManager {
> 
>     static const char[] SOFT32_ICO = "soft32.ico";
>     static const char[] SOFT32_PNG = "soft32.png";
> 
>     this()
>     {
>         ir = new ImageRegistry();
> 
>         ir.put(SOFT32_ICO, ImageDescriptor.createFromFile(getImportData!(SOFT32_ICO)));       
>         ir.put(SOFT32_PNG, ImageDescriptor.createFromFile(getImportData!(SOFT32_PNG)));
> 
>         assert( get(SOFT32_ICO) !is null);//image is null
>         assert( get(SOFT32_PNG) !is null); //image is null 
>     }
> 
>     Image get(char[] key)
>     {
>         return ir.get(key);
>     }
> 
>     private ImageRegistry ir;
> 
> } // end class ImageManager
> 
> 
> 
> 

While trying this, i get first an access violation, because no Display 
was created before. I don't know if should be seen as an error in DWT.

The real problem was in ArrayWrapperT that is used as a encapsulation 
object for char[]. It did not have a toHash(), hence the HashMap in 
ImageRegistry did not retrieve the object properly.
It is now fixed in dwt-win.




More information about the Digitalmars-d-dwt mailing list