lcaron / opal

Main repository for the Opal Project (SWT new widgets library)
50 stars 32 forks source link

Angle Slider: setSelection always raise an java.lang.IllegalArgumentException: null soure #54

Closed dejawho closed 7 years ago

dejawho commented 8 years ago

Hi, AngleSlider has a serious bug in the setSelecition method. When it fire the selectionListeners it create a new Event(), then this event is used to build a selection event. But a selection event need to have in the passed event the filed widget set, otherwise it will trigger the IllegalAegumentSection. The fix is pretty easy and simple:

public void setSelection(final int selection) {
    checkWidget();
    if (selection < 0 || selection > 360) {
        SWT.error(SWT.ERROR_CANNOT_SET_SELECTION);
    }
    this.selection = selection;
    Event e = new Event();
            e.widget = this;
            fireSelectionListeners(e);
    redraw();
}
lcaron commented 7 years ago

Fix in next release