Exemplo

public class ClassA {

private TextLayout textLayout;

public void makeTextLayout( Device device ) {

textLayout = new TextLayout( device );

if ( !textLayout.isDisposed() ) {
//executar algo...
}
}
}



Solução
Para evitar fugas de recursos, certifique-se de que dispose() seja chamado em cada org.eclipse.swt.graphics.TextLayout.



public class ClassA {

private TextLayout textLayout;

public void makeTextLayout( Device device ) {

textLayout = new TextLayout( device );

if ( !textLayout.isDisposed() ) {
//executar algo...
}
textLayout.dispose();
}
}