Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 319433 - Generation of SWT image from SVG leaks GDI resources
Summary: Generation of SWT image from SVG leaks GDI resources
Status: RESOLVED FIXED
Alias: None
Product: GMF-Runtime
Classification: Modeling
Component: General (show other bugs)
Version: 1.4.0   Edit
Hardware: PC Windows XP
: P3 normal
Target Milestone: 1.4.1   Edit
Assignee: Alex Boyko CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-09 17:12 EDT by Alex Boyko CLA
Modified: 2010-07-16 15:13 EDT (History)
2 users (show)

See Also:


Attachments
patch (7.01 KB, patch)
2010-07-09 17:12 EDT, Alex Boyko CLA
no flags Details | Diff
patch (7.08 KB, patch)
2010-07-12 11:41 EDT, Alex Boyko CLA
aboyko: review?
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Boyko CLA 2010-07-09 17:12:16 EDT
Created attachment 173922 [details]
patch

To reproduce:
Get SWT Sleak and install it
Open SWT Tools -> Sleak view
1. Open a diagram with lots of SVG images
2. Close the diagram
3. Take a Snap in the Sleak view

Note that there are lots of SWT Paths for parts of SVGs as well as Images for partial or entire SVGs

Problems:

There are a lot of leaks in Graphics2DGraphicsAdaptor for SWT Path

SVGImageConverter#renderSVGtoSWTImage(...) leaks SWT Image if exception is thrown generating SWT image directly from SVG (happens often, because not all SVG features are supported by SWT, yet supported by AWT)

AbstractRenderedImage doesn't dispose the old image before setting the new one. Happens if the same image is rendered on different threads - shouldn't happen though.

CanonicalEditPolicy#prepareAdapterList(...) leaks editparts. When editor is closed the edititng domain remains and holds onto executed commands, hence commands should not be holding onto editparts. SetMutability commands do, because they may have an editpart in the view adapters list.
Comment 1 Alex Boyko CLA 2010-07-12 11:41:53 EDT
Created attachment 174052 [details]
patch

Corrected the patch (CanonicalEditPolicy - correctly added the view adapter for the host editpart)

Lidija, Anthony, could one of you please review this fix?
Comment 2 Lidija Grahek CLA 2010-07-12 13:16:58 EDT
All the changes look good to me.
Comment 3 Alex Boyko CLA 2010-07-12 14:34:03 EDT
Great - thanks!
Delivered to HEAD and R1_4_maintenance