| Summary: | Object comparison instead of value comparison | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Tools] GEF | Reporter: | Juergen Denner <j.denner> | ||||
| Component: | GEF-Legacy Draw2d | Assignee: | Marc Gobeil <mgobeil> | ||||
| Status: | RESOLVED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | ahunter.eclipse | ||||
| Version: | 3.5 | ||||||
| Target Milestone: | 3.6.0 (Helios) M6 | ||||||
| Hardware: | PC | ||||||
| OS: | Windows Vista | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
Created attachment 139750 [details]
patch for setters
This should fix it, and also reduce unnecessary object creation in the setter methods for both Alpha and Antialias properties.
I did some quick testing of the patch, but would someone mind double checking the if statements I've added to make sure they don't miss any cases?
I think this is good to commit. (In reply to comment #2) > I think this is good to commit. I cannot recally why we did not commit this. Committed to HEAD for 3.6 |
The 3.5 shape class contains the following code: --- ... public void setAlpha(Integer value) { if(alpha != value) { alpha = value; repaint(); } } public void setAlpha(int value) { setAlpha(new Integer(value)); } ... --- Invoking setAlpha(255) two times in a row, leads to two repaint calls. This is because "alpha != value" compare pointers and not values and 255 is always boxed to new Integer. In our application, setAlpha(255) was invoked within a shapes overwritten paintFigure method. This triggered a repaint and in the end, the application was permanently repainting. alpha can be null but if it's not null, the value should be compared. The same applies to setAntialias. Kind regards, Jürgen