| Summary: | Different instances of FormColors return the same Color objects causing SWT errors on disposal | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Justin Dolezy <justin> | ||||
| Component: | User Assistance | Assignee: | platform-ua-inbox <platform-ua-inbox> | ||||
| Status: | RESOLVED INVALID | QA Contact: | |||||
| Severity: | major | ||||||
| Priority: | P3 | CC: | caniszczyk, cgold | ||||
| Version: | 3.4 | ||||||
| Target Milestone: | --- | ||||||
| Hardware: | All | ||||||
| OS: | All | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
|
Description
Justin Dolezy
Created attachment 169001 [details]
Test case showing different FormColor instances now returning the same Color objects
The javadoc of createColor says: "Creates the color for the specified key using the provided RGB object. The color object will be returned and also put into the registry. When the class is disposed, the color will be disposed with it." So you shouldn't be disposing it. As a simple rule, you dispose only the items that you create (using new Color() or new Font() etc) if its created by other classes, the onus is on that other class to dispose it. I'm assigning to UA for comments Thanks Prakash, seems like this is turning into "User Error". I'll repeat the mantra "if I new'd the resource, then I dispose the resource"... must working whilst too tired to have managed to dislodge that :) Prakash is correct, colors created by FormColors are reused and you should not call dispose on them. When FormColors is disposed it will also dispose of any colors it has created. |