[jbosstools-issues] [JBoss JIRA] (JBIDE-10231) org.jboss.tools.common.model has potential Image leaks

Viacheslav Kabanovich (Resolved) (JIRA) jira-events at lists.jboss.org
Wed Nov 30 17:05:40 EST 2011


     [ https://issues.jboss.org/browse/JBIDE-10231?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Viacheslav Kabanovich resolved JBIDE-10231.
-------------------------------------------

    Resolution: Done

    
> org.jboss.tools.common.model has potential Image leaks
> ------------------------------------------------------
>
>                 Key: JBIDE-10231
>                 URL: https://issues.jboss.org/browse/JBIDE-10231
>             Project: Tools (JBoss Tools)
>          Issue Type: Sub-task
>          Components: common/jst/core
>    Affects Versions: 3.3.0.M4
>            Reporter: Vitali Yemialyanchyk
>            Assignee: Viacheslav Kabanovich
>            Priority: Minor
>             Fix For: 3.3.0.Beta1
>
>
> small note -> org.jboss.tools.common.model.icons.impl.XStudioIcons:
> {code}
>     public Image getImage(XModelObject obj) {                       <---------------- this function create Image and does not dispose it - so real name should sounds like createImage(...)
>         String s = obj.getAttributeValue("image"); //$NON-NLS-1$
>         byte[] b = decode(s);
>         if(b != null) {
>         	try { 
>         		ByteArrayInputStream is = new ByteArrayInputStream(b);
>         		ImageData id = new ImageData(is);
>         		Image i = new Image(null, id);                        <---- create image here    
>         		return i;
>         	} catch (SWTException e) {
>         		ModelPlugin.getPluginLog().logError(e);
>         	} catch (SWTError e) {
>         		ModelPlugin.getPluginLog().logError(e);
>         	}
>         }
>    		return obj.getModelEntity().getMetaModel().getIconList().getImage("default.unknown"); //$NON-NLS-1$
>     }
> {code}
> org.jboss.tools.common.model.icons.impl.XModelObjectIcon
> {code}
> private static Hashtable<String,Image> cacheEclipse = new Hashtable<String,Image>();
> {code}
> all images which XStudioIcons creates --> in cacheEclipse.
> but what is happens if you reload org.jboss.tools.common.model plugin? I do not sure, but look like you'll get resource leak here.
> may be a better choise is to use AbstractUIPlugin.getImageRegistry(), i.e. ModelPlugin.getDefault().getImageRegistry()

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jbosstools-issues mailing list