Beispiel
public class
ClassA {
private
TextLayout textLayout;
public void
makeTextLayout( Device device ) {
textLayout =
new
TextLayout( device );
if ( !textLayout.isDisposed() ) {
//do something...
}
}
}
Lösung
Um Ressourcenlecks zu vermeiden, stellen Sie sicher, dass die Methode 'dispose()' für jedes Vorkommen von 'org.eclipse.swt.graphics.Textlayout' aufgerufen wird.
public class
ClassA {
private
TextLayout textLayout;
public void
makeTextLayout( Device device ) {
textLayout =
new
TextLayout( device );
if ( !textLayout.isDisposed() ) {
//do something...
}
textLayout.dispose();
}
}