Példa
public class
ClassA {
private
TextLayout textLayout;
public void
makeTextLayout( Device device ) {
textLayout =
new
TextLayout( device );
if ( !textLayout.isDisposed() ) {
//csináljon valamit...
}
}
}
Megoldás
Az erőforrás-szivárgások elkerülés érdekében győződjön meg róla, hogy a dispose() metódus minden org.eclipse.swt.graphics.TextLayout objektumon meghívásra kerül.
public class
ClassA {
private
TextLayout textLayout;
public void
makeTextLayout( Device device ) {
textLayout =
new
TextLayout( device );
if ( !textLayout.isDisposed() ) {
//csináljon valamit...
}
textLayout.dispose();
}
}