[jbosstools-issues] [JBoss JIRA] (JBIDE-10247) org.jboss.tools.jst.css: org.jboss.tools.jst.css.dialog.selector.CSSSelectorPartComposite has 4 Image leaks

Viacheslav Kabanovich (Commented) (JIRA) jira-events at lists.jboss.org
Fri Dec 16 12:59:09 EST 2011


    [ https://issues.jboss.org/browse/JBIDE-10247?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12651703#comment-12651703 ] 

Viacheslav Kabanovich commented on JBIDE-10247:
-----------------------------------------------

Widget.release
{code}
void release (boolean destroy) {
    ...
    releaseChildren (destroy);
    ...
}
{code}

Composite.releaseChildren
{code}
void releaseChildren (boolean destroy) {
	Control [] children = _getChildren ();
	for (int i=0; i<children.length; i++) {
		Control child = children [i];
		if (child != null && !child.isDisposed ()) {
			child.release (false);
		}
	}
	super.releaseChildren (destroy);
}
{code}

Vitali, comment to dispose() says two important things
1) It promises to "Dispose of the operating system resources associated with the receiver and all its descendants". 
2) dispose() is not called recursively.

Please do not look for a contradiction here. In my opinion, the behavior (2) is implemented to discourage overriding dispose() method, because custom implementation would have to call super.dispose(), and a lot of programmers would forget it and cause a lot of trouble. By means of (2), Eclipse can implement (1) consistently and reliably. I repeat that if your tool detected leak of resource in Button, it must be SWT bug, please report it to Eclipse, it is critical, generally. In particular case of CSSSelectorPartComposite it is not critical, but we have a lot of places where button.setEnabled() is invoked. 


                
> org.jboss.tools.jst.css: org.jboss.tools.jst.css.dialog.selector.CSSSelectorPartComposite has 4 Image leaks
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: JBIDE-10247
>                 URL: https://issues.jboss.org/browse/JBIDE-10247
>             Project: Tools (JBoss Tools)
>          Issue Type: Sub-task
>          Components: common/jst/core
>    Affects Versions: 3.3.0.M4
>            Reporter: Vitali Yemialyanchyk
>            Assignee: Viacheslav Kabanovich
>             Fix For: 3.3.0.Beta1
>
>
> try to test with "Sleak" tool - should get at least 4 images leak:
> line 357: rightButton.setEnabled(false);
> line 371: leftButton.setEnabled(false);
> line 384: upButton.setEnabled(false);
> line 397: downButton.setEnabled(false);
> - these lines responsible for image leaks. To avoid leaks you should call dispose directly in proper place:
> rightButton.dispose();
> leftButton.dispose();
> upButton.dispose();
> downButton.dispose();

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