Hi,
if I draw something new in my HUD, I try to delete the old TextureState. However, from time to time I get a ConcurrentModificationException. Is it possible to avoid this, or should I just ignore it? Here is the code:
protected void setBufferedImage(BufferedImage bi, Quad quad) {
TextureState ts = DisplaySystem.getDisplaySystem().getRenderer().createTextureState();
Texture t = TextureManager.loadTexture(bi, Texture.MM_LINEAR, Texture.MM_LINEAR, 1, false);
ts.setTexture(t);
final TextureState oldTs = (TextureState)quad.getRenderState(RenderState.RS_TEXTURE);
quad.setRenderState(ts);
quad.updateRenderState();
if(oldTs != null) {
GameTaskQueueManager.getManager().update(new Callable<Object>() {
public Object call() throws Exception {
try {
oldTs.deleteAll(true);
} catch (ConcurrentModificationException ex) {
/*hmmm*/
}
return null;
}
});
}
}