Uploaded image for project: 'Tools (JBoss Tools)'
  1. Tools (JBoss Tools)
  2. JBIDE-10221 Resorce leak problems in JBossTools
  3. JBIDE-10231

org.jboss.tools.common.model has potential Image leaks

    XMLWordPrintable

Details

    • Sub-task
    • Resolution: Done
    • Minor
    • 3.3.0.M5
    • 3.3.0.M4
    • common
    • None

    Description

      small note -> org.jboss.tools.common.model.icons.impl.XStudioIcons:

          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$
          }
      
      

      org.jboss.tools.common.model.icons.impl.XModelObjectIcon

      private static Hashtable<String,Image> cacheEclipse = new Hashtable<String,Image>();
      

      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()

      Attachments

        Activity

          People

            scabanovich Viacheslav Kabanovich (Inactive)
            vyemialyanchyk_jira Vitali Yemialyanchyk (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: