| Summary: | PrinterGraphics does not dispose imageCache | ||
|---|---|---|---|
| Product: | [Tools] GEF | Reporter: | Marcos César de Oliveira <mcesar> |
| Component: | GEF-Legacy Draw2d | Assignee: | Steven R. Shaw <steveshaw> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P1 | ||
| Version: | 3.1.1 | ||
| Target Milestone: | 3.2.0 (Callisto) M6 | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | |||
Puxa vida... This will get fixed for 3.2. added dispose method to PrinterGraphics. |
PrinterGraphics maintains an cache of resized images in the imageCache field, but neither disposes the images created nor allows them to be disposed, resulting in the leak of the images. This is the code I have used to do the disposition of the images: Map imageCache = null; try { Field field = PrinterGraphics.class.getDeclaredField("imageCache"); field.setAccessible(true); imageCache = (Map) field.get(graphics); } catch (Exception e) { e.printStackTrace(); } if (imageCache != null) { for (Image image : (Collection<Image>) imageCache.values()) { image.dispose(); } }