Community
Participate
Working Groups
A call to notifyListeners(SWT.Dispose, event) on any widget, results in a ClassCastException. To reproduce it, just add the following lines to a widget like Text: final Event newEvent = new Event(); newEvent.widget = this; newEvent.type = SWT.Dispose; newEvent.display = getDisplay(); notifyListeners(SWT.Dispose, newEvent); This bug can also be reproduced by using the Riena ExampleClient and then go to Playground => Playground => Combos => CompletionCombo. Widget.notfyListener() calls UntypedEventAdapter.notifyListeners( final int eventType, final Event event ) which checks if it is a DisposeEventType and then tries to create a new DisposeEvent(event). DisposeEvent has a single argument constructor of type object, but the super constructor in TypedEvent expects the first parameter to be a widget. This of course results in a ClassCastException, because we passed in a Event instead of a Widget. In my opinion UntypedEventAdapter should pass the widget from the source event to the new created DisposeEvent like: ... case SWT.Dispose: typedEvent = new DisposeEvent( event.widget); ...
Added missing ctor DisposeEvent( Event ). Fixed in CVS HEAD.