Buggy code:
public class GpuUploader { static final int [ ] CUBE_MAP_SIDES = new int [ ] { WebGLRenderingContext . TEXTURE_CUBE_MAP_POSITIVE_X , WebGLRenderingContext . TEXTURE_CUBE_MAP_NEGATIVE_X , WebGLRenderingContext . TEXTURE_CUBE_MAP_POSITIVE_Z , WebGLRenderingContext . TEXTURE_CUBE_MAP_NEGATIVE_Z , WebGLRenderingContext . TEXTURE_CUBE_MAP_POSITIVE_Y , WebGLRenderingContext . TEXTURE_CUBE_MAP_NEGATIVE_Y } ; WebGLRenderingContext gl ; ResourceLoader resourceLoader ; HashMap < Geometry , GeometryBuffers > geometryBuffers = new HashMap < Geometry , GeometryBuffers > ( ) ; HashMap < Object3d , WebGLBuffer > objectBuffers = new HashMap < Object3d , WebGLBuffer > ( ) ; HashMap < Texture , WebGLTexture > textures = new HashMap < Texture , WebGLTexture > ( ) ; HashMap < Texture , ImageElement > textureImages = new HashMap < Texture , ImageElement > ( ) ; HashMap < CubeMapTexture , WebGLTexture > cubeMapTextures = new HashMap < CubeMapTexture , WebGLTexture > ( ) ; HashMap < CubeMapTexture , ImageElement [ ] > cubeMapImages = new HashMap < CubeMapTexture , ImageElement [ ] > ( ) ; ArrayList < Program > shaderPrograms = new ArrayList < Program > ( ) ; TextureLoadedListener textureLoadedListener ; public GpuUploader ( WebGLRenderingContext gl , ResourceLoader resourceLoader , TextureLoadedListener textureLoadedListener ) { } public Program getProgram ( Scene scene , Material material ) { } public GeometryBuffers upload ( Geometry geometry3d ) { } public WebGLBuffer uploadVertexColors ( Object3d object ) { } public void upload ( final Renderer3d renderer3d , final Texture texture , final int activeTexture ) { } public void upload ( final Renderer3d renderer3d , final CubeMapTexture cubeMapTexture , final int activeTexture ) { } public void textureLoaded ( Renderer3d renderer3d , Texture texture , int activeTexture ) { } public void cubeTextureLoaded ( Renderer3d renderer3d , CubeMapTexture cubeMapTexture , int activeTexture ) { } public void unload ( Object o ) { if ( o instanceof Geometry ) { if ( geometryBuffers . containsKey ( o ) ) { ( ( Geometry ) ( o ) ) . status = 0 ; GeometryBuffers buffers = geometryBuffers . get ( o ) ; if ( ( buffers . vertexBufferId ) != null ) { gl . deleteBuffer ( buffers . vertexBufferId ) ; } if ( ( buffers . normalsBufferId ) != null ) { gl . deleteBuffer ( buffers . normalsBufferId ) ; } if ( ( buffers . uvsBufferId ) != null ) { gl . deleteBuffer ( buffers . uvsBufferId ) ; } if ( ( buffers . facesBufferId ) != null ) { gl . deleteBuffer ( buffers . facesBufferId ) ; } geometryBuffers . remove ( o ) ; } } else if ( o instanceof Texture ) { if ( textures . containsKey ( o ) ) { ( ( Texture ) ( o ) ) . status = 0 ; gl . deleteTexture ( textures . get ( o ) ) ; textures . remove ( o ) ; } } else if ( o instanceof CubeMapTexture ) { if ( cubeMapTextures . containsKey ( o ) ) { ( ( Texture ) ( o ) ) . status = 0 ; gl . deleteTexture ( cubeMapTextures . get ( o ) ) ; <START_BUG> textures . remove ( o ) ; <END_BUG> } } else if ( o instanceof Object3d ) { WebGLBuffer bufferId = objectBuffers . remove ( o ) ; if ( bufferId != null ) { gl . deleteBuffer ( bufferId ) ; } } } public void reset ( ) { } No newline ; at end ; of file ; }

Fix:
cubeMapTextures . remove ( o ) ;