| Summary: | ClassCastException in DisposeEvent | ||
|---|---|---|---|
| Product: | [RT] RAP | Reporter: | Steffen Kriese <steffen.kriese> |
| Component: | RWT | Assignee: | Project Inbox <rap-inbox> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | ||
| Version: | 1.4 | ||
| Target Milestone: | 1.4 M3 | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
| Bug Depends on: | |||
| Bug Blocks: | 324443 | ||
Added missing ctor DisposeEvent( Event ). Fixed in CVS HEAD. |
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); ...