www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.dwt - Weird JFace Preferences bug

reply Gian Perrone <gperrone gmx.de> writes:
I think I found a really weird bug in JFace. I use DWT 3.4-1, Tango
0.99.7 and DMD 1.028.
A minimal example really is minimal:

---

module bug;

import jive.stacktrace; //Optional
import dwtx.jface.preference.PreferenceManager;

void main(char[][] args) {
}

---

If libicu is not installed, it crashes at runtime. Should better be a
compile time error. If it is installed:

---

tango.core.Exception.IllegalElementException: Attempt to include invalid
key _in Collection
----------------
0x0827d4b5 [bug] object.traceContext
0x0827d428 [bug] object.Exception._ctor
0x08277ca9 [bug] tango.core.Exception.IllegalElementException._ctor
0x0809c3b5 [bug]
tango.util.collection.impl.MapCollection.MapCollection!(dwt.widgets.Display,
dwtx.jface.resource.ResourceManager).MapCollection.checkKey
0x0809af6b [bug]
tango.util.collection.HashMap.HashMap!(dwt.widgets.Display,
dwtx.jface.resource.ResourceManager).HashMap.add
0x08099fc9 [bug]
dwtx.jface.resource.JFaceResources.JFaceResources.getResources
0x08099f67 [bug]
dwtx.jface.resource.JFaceResources.JFaceResources.getResources
0x0809a156 [bug]
dwtx.jface.resource.JFaceResources.JFaceResources.getImageRegistry
0x0815bfb0 [bug]
dwtx.jface.viewers.DialogCellEditor.DialogCellEditor._staticCtor18
0x0815c63b [bug] dwtx.jface.viewers.DialogCellEditor.__modctor
0x0827d6c1 [bug] object._moduleCtor2
0x0827d704 [bug] object._moduleCtor2
0x0827d5a3 [bug] _moduleCtor
0x0827e036 [bug] dmain2.main.runAll
0x0827dde8 [bug] dmain2.main.tryExec
0x0827dd91 [bug] main
0xf75ae44f [libc-2.7.so]
0x08054400 [bug] _start

---

I spent a lot of time finding what caused this. The minimal *working*
example is:

---

module bug;

import dwtx.jface.preference.PreferenceManager;
import dwt.widgets.Display;
import dwt.layout.RowLayout;

void main(char[][] args) {
}

---

You have to import Display and RowLayout or else a static this() fails.
I didn't find any clue what actually causes this behaviour.
Jan 21 2009
parent Frank Benoit <keinfarbton googlemail.com> writes:
Gian Perrone schrieb:
 I think I found a really weird bug in JFace. I use DWT 3.4-1, Tango
 0.99.7 and DMD 1.028.
 A minimal example really is minimal:
 
 ---
 
 module bug;
 
 import jive.stacktrace; //Optional
 import dwtx.jface.preference.PreferenceManager;
 
 void main(char[][] args) {
 }
 
 ---
 
 If libicu is not installed, it crashes at runtime. Should better be a
 compile time error. If it is installed:
 
 ---
 
 tango.core.Exception.IllegalElementException: Attempt to include invalid
 key _in Collection
 ----------------
 0x0827d4b5 [bug] object.traceContext
 0x0827d428 [bug] object.Exception._ctor
 0x08277ca9 [bug] tango.core.Exception.IllegalElementException._ctor
 0x0809c3b5 [bug]
 tango.util.collection.impl.MapCollection.MapCollection!(dwt.widgets.Display,
 dwtx.jface.resource.ResourceManager).MapCollection.checkKey
 0x0809af6b [bug]
 tango.util.collection.HashMap.HashMap!(dwt.widgets.Display,
 dwtx.jface.resource.ResourceManager).HashMap.add
 0x08099fc9 [bug]
 dwtx.jface.resource.JFaceResources.JFaceResources.getResources
 0x08099f67 [bug]
 dwtx.jface.resource.JFaceResources.JFaceResources.getResources
 0x0809a156 [bug]
 dwtx.jface.resource.JFaceResources.JFaceResources.getImageRegistry
 0x0815bfb0 [bug]
 dwtx.jface.viewers.DialogCellEditor.DialogCellEditor._staticCtor18
 0x0815c63b [bug] dwtx.jface.viewers.DialogCellEditor.__modctor
 0x0827d6c1 [bug] object._moduleCtor2
 0x0827d704 [bug] object._moduleCtor2
 0x0827d5a3 [bug] _moduleCtor
 0x0827e036 [bug] dmain2.main.runAll
 0x0827dde8 [bug] dmain2.main.tryExec
 0x0827dd91 [bug] main
 0xf75ae44f [libc-2.7.so]
 0x08054400 [bug] _start
 
 ---
 
 I spent a lot of time finding what caused this. The minimal *working*
 example is:
 
 ---
 
 module bug;
 
 import dwtx.jface.preference.PreferenceManager;
 import dwt.widgets.Display;
 import dwt.layout.RowLayout;
 
 void main(char[][] args) {
 }
 
 ---
 
 You have to import Display and RowLayout or else a static this() fails.
 I didn't find any clue what actually causes this behaviour.
 
The problem occurs in the tango.util.collections. They are used in the latest release. But the current development repositories do no more use those, they use the tango.util.containers and have explicit wrappers to make them compatible to the Java collections. I would recommend to use the sources from the dev repository. The reason there is not a more actual release is, I am waiting for the next tango release. :/ I tried your testcase with the current source code, current tango from svn, the ICU libs removed, on winxp. The was no error shown.
Jan 21 2009