Příklad

public class ClassA {

private TextLayout textLayout;

public void makeTextLayout( Device device ) {

textLayout = new TextLayout( device );

if ( !textLayout.isDisposed() ) {
//něco provést...
}
}
}



Řešení
Ujistěte se, že je metoda dispose() vyvolána na každém objektu org.eclipse.swt.graphics.TextLayout, abyste se vyvarovali únikům prostředků.



public class ClassA {

private TextLayout textLayout;

public void makeTextLayout( Device device ) {

textLayout = new TextLayout( device );

if ( !textLayout.isDisposed() ) {
//něco provést...
}
textLayout.dispose();
}
}