Bug 573067 - Resource tied to UI framework does not dispose and causes stack in headless
Summary: Resource tied to UI framework does not dispose and causes stack in headless
Status: RESOLVED FIXED
Alias: None
Product: Epsilon
Classification: Modeling
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Dimitris Kolovos CLA
QA Contact:
URL:
Whiteboard:
Keywords: ui, usability
Depends on:
Blocks:
 
Reported: 2021-04-21 19:46 EDT by Joern Guy Suess CLA
Modified: 2021-04-26 09:46 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joern Guy Suess CLA 2021-04-21 19:46:53 EDT
org.eclipse.epsilon.common.dt.launching.extensions.ModelTypeExtension.java l.105
Comment 1 Joern Guy Suess CLA 2021-04-21 20:03:16 EDT
SWT resource tracking shows:

java.lang.Error: SWT Resource was not properly disposed

This is due to 

org.eclipse.epsilon.common.dt.launching.extensions.ModelTypeExtension.java at l.105

Where it allocates an image descriptor:

Image image = AbstractUIPlugin.imageDescriptorFromPlugin(contributingPlugin,configurationElement.getAttribute("icon")).createImage();
modelType.setImage(image);

But it never disposes it as part of the lifecycle.

Suggested approach:

Remove dependency on the UI. Types are models, not SWT UI elements.

Remove the dependency on the packages:

import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.plugin.AbstractUIPlugin;

Change ModelLabelProvider l.286 and ModelTypeLabelProvider l.25 to load the resource from the plugin.
Comment 2 Dimitris Kolovos CLA 2021-04-26 09:46:34 EDT
Thanks for reporting this. I've made ModelTypeExtension.getImage() lazy in [1], so that code that doesn't make use of images doesn't have to worry about disposing of them either.

[1] https://git.eclipse.org/c/epsilon/org.eclipse.epsilon.git/commit/?id=df5b881707048f3f0874932a81f6de65ba75a54a