Sfoglia il codice sorgente

realloc before clone()

ncannasse 7 anni fa
parent
commit
b15049c3ad
1 ha cambiato i file con 5 aggiunte e 0 eliminazioni
  1. 5 0
      h3d/mat/Texture.hx

+ 5 - 0
h3d/mat/Texture.hx

@@ -99,6 +99,11 @@ class Texture {
 	}
 
 	public function clone( ?allocPos : h3d.impl.AllocPos ) {
+		if( t == null ) {
+			if( realloc == null ) throw "Can't clone disposed texture";
+			alloc();
+			realloc();
+		}
 		var old = lastFrame;
 		preventAutoDispose();
 		var flags = [];