Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 348020

Summary: [TMF] Color resource leak in Colors view
Product: z_Archived Reporter: Patrick Tasse <patrick.tasse>
Component: LinuxToolsAssignee: Francois Chouinard <fchouinard>
Status: CLOSED FIXED QA Contact: Francois Chouinard <fchouinard>
Severity: normal    
Priority: P3 CC: overholt
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 301610    
Attachments:
Description Flags
Proposed patch in org.eclipse.linuxtools.tmf.ui package fchouinard: iplog+

Description Patrick Tasse CLA 2011-06-01 17:20:14 EDT
Build Identifier: 

Submitting a patch to fix a resource leak in the Colors view.

The Colors view is used to manage color settings used by the events table. The ColorSetting object contains four Color resource instances which must be disposed when no longer required. When the user deletes a color setting in the Colors view, or overwrites color settings during an import action, the Color resources held by the color setting are never disposed.

The solution is to implement a dispose() method in the ColorSetting class, and invoke it whenever the color setting is no longer needed.

Reproducible: Always

Steps to Reproduce:
0. Run in Debug mode and put a breakpoint in the Color(Resource) constructors and dispose() method
1. In the Colors view, add a color setting
2. Observe that four Color instances are created
3. Export the color setting to file
4. Delete the color setting
5. Observe that the Color instances are not disposed as required by their API
6. Add a new color setting
7. Import the color setting exported in step 3
8. Choose Yes to overwrite the current color settings
9. Observe that the new color setting Color instances are not disposed
Comment 1 Patrick Tasse CLA 2011-06-01 17:21:31 EDT
Created attachment 197180 [details]
Proposed patch in org.eclipse.linuxtools.tmf.ui package

Legal Message: I, Patrick Tasse, declare that I developed attached code from
scratch, without referencing any 3rd party materials except material licensed
under the EPL. I am authorized by my employer to make this contribution under
the EPL.
Comment 2 Andrew Overholt CLA 2011-06-01 17:27:05 EDT
Note that we cannot accept patches for inclusion in Indigo at this time as our IP log has already been submitted.  We will happily include such patches (or run them through the IP process if they are > 250 lines) post-Indigo for potential inclusion in our Indigo SR1 contribution and any Linux Tools releases in between Indigo and Indigo SR1.
Comment 3 Francois Chouinard CLA 2011-07-22 15:47:31 EDT
Comment on attachment 197180 [details]
Proposed patch in org.eclipse.linuxtools.tmf.ui package

Patch merged
Comment 4 Francois Chouinard CLA 2011-07-22 15:47:49 EDT
Planned for 0.8.1
Comment 5 Andrew Overholt CLA 2011-08-15 14:37:20 EDT
Has this been cherry-picked to stable-0.8?
Comment 6 Francois Chouinard CLA 2011-08-23 17:59:59 EDT
Fix committed on stable-0.8 branch.
Comment 7 Francois Chouinard CLA 2011-09-28 17:32:40 EDT
Delivered with 0.8.1