Bug on version 9.4.2

I found an issue with a big project I am working on. I left it on jan 25 and I am restarting with it now. so I am not sure which version started to fail. Since it is a huge project it is slightly difficult to track the exact point but, I would be able to Isolate the problem to a few lines of code.
I have this class:

class Sprite3D extends Sprite
{
private var bmpData:BitmapData;
public var pProjection:PerspectiveProjection;
private var plane:Sprite = new Sprite();
private var mat:Matrix3D = new Matrix3D();
public var proj:Matrix3D;
private var vertices:Vector<Float>;
private var uvt:Vector<Float>=Vector.ofArray([0.0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0]);
private var indices:Vector<Int>=Vector.ofArray([0, 1, 3, 1, 2, 3]);     
private var projectedPoints:Vector<Float>;    
public var posX:Float;
public var posY:Float;
public var posZ:Float;//480.245531742791;
public var rotX:Float;
public var rotY:Float;
public var rotZ:Float;

public var scX:Float = 1.0;
public var scY:Float = 1.0;
public var scZ:Float = 1.0;




public function new(inputDisplayObject:BitmapData){
    super();     
	
	
	
	//this.blendMode = blendMode.ADD;
	//trace('creando ' + inputDisplayObject.image.src);
	bmpData = new BitmapData(Math.ceil(inputDisplayObject.width), Math.ceil(inputDisplayObject.height), true);
	bmpData.copyPixels(inputDisplayObject, inputDisplayObject.rect, new Point(0, 0));
	vertices = Vector.ofArray([ -Math.ceil(inputDisplayObject.width) / 2, -Math.ceil(inputDisplayObject.height) / 2, 0, Math.ceil(inputDisplayObject.width) / 2, -Math.ceil(inputDisplayObject.height) / 2, 0, Math.ceil(inputDisplayObject.width) / 2, Math.ceil(inputDisplayObject.height) / 2, 0, -Math.ceil(inputDisplayObject.width) / 2, Math.ceil(inputDisplayObject.height) / 2, 0.0]);
	
	pProjection = new PerspectiveProjection();
	pProjection.fieldOfView = 55; 
	proj = pProjection.toMatrix3D(); 
	this.addChild(plane);
	render();
	



	//plane.width = bmpData.width;
	//plane.height = bmpData.height;

}   

public function free(){
	this.removeChildren(0, this.numChildren - 1);
}
public function changeColor(newColor:BitmapData){
	
	bmpData.copyPixels(newColor, newColor.rect, new Point(0, 0));
	
	//bmpData = newColor;
	this.blendMode = blendMode.ADD;
	//this.blendMode = blendMode.OVERLAY;
	//this.blendMode = blendMode.SUBTRACT;
	
	//this.width = 256;
	//this.height = 256;
	this.render();
	
}


public function render():Void{
	
	mat.identity();
	mat.appendRotation(rotX, Vector3D.X_AXIS);
	mat.appendRotation(rotY, Vector3D.Y_AXIS);
	mat.appendScale(scX, scY, scZ);
	mat.appendTranslation(posX, posY, posZ);
	mat.append(proj);
	projectedPoints = new Vector<Float>();
	Utils3D.projectVectors(mat, vertices, projectedPoints, uvt);
	
	plane.graphics.clear();
	

	
	plane.graphics.beginBitmapFill(bmpData, null, false, true);
	
	//plane.graphics.drawRect(0.0, 0.0, bmpData.width, bmpData.height);
	
	plane.graphics.drawTriangles(projectedPoints, indices, uvt, TriangleCulling.NONE);
	plane.graphics.endFill(); 
	
	
		var scale:Float = (pProjection.focalLength / posZ);
		var inverseScale = 1 - scale;
		//var deltaX:Float = 616 * inverseScale;
		var deltaX:Float = 614 * inverseScale;
		//var deltaY:Float = -1200 * inverseScale;
		var deltaY:Float = -1200 * inverseScale;
		plane.y = deltaY;
		
	
	
}	
}

Now everithing works fine in version 9.2.0, but in the last production version it throws:

CanvasDisplayObject.hx:62 Uncaught InvalidStateError: Failed to execute ‘drawImage’ on ‘CanvasRenderingContext2D’: The image argument is a canvas element with a width or height of 0.
at openfl_display__$internal_CanvasDisplayObject.renderDrawable (CanvasDisplayObject.hx:62:5)
at openfl_display__$internal_CanvasDisplayObjectContainer.renderDrawable (CanvasDisplayObjectContainer.hx:18:3)
at openfl_display_CanvasRenderer._renderDrawable (CanvasRenderer.hx:196:5)
at openfl_display_$internal_CanvasDisplayObjectContainer.renderDrawable (CanvasDisplayObjectContainer.hx:28:5)
at openfl_display_CanvasRenderer._renderDrawable (CanvasRenderer.hx:196:5)
at openfl_display_$internal_CanvasDisplayObjectContainer.renderDrawable (CanvasDisplayObjectContainer.hx:28:5)
at openfl_display_CanvasRenderer._renderDrawable (CanvasRenderer.hx:196:5)
at openfl_display_$internal_CanvasDisplayObjectContainer.renderDrawable (CanvasDisplayObjectContainer.hx:28:5)
at openfl_display_CanvasRenderer._renderDrawable (CanvasRenderer.hx:196:5)
at openfl_display_$internal_CanvasDisplayObjectContainer.renderDrawable (CanvasDisplayObjectContainer.hx:28:5)

If I comment this lines:

plane.graphics.clear();
	

	
	plane.graphics.beginBitmapFill(bmpData, null, false, true);
	
	//plane.graphics.drawRect(0.0, 0.0, bmpData.width, bmpData.height);
	
	plane.graphics.drawTriangles(projectedPoints, indices, uvt, TriangleCulling.NONE);
	plane.graphics.endFill(); 

everything else seems to work fine. and as I said in version 9.2.0 works perfectly

I hope to contribute with 0.02 cents to the project.

With regards

Luis

I am curious, what is the actual size of the canvas element in your browser? Can you inspect it in the developer tools pane? Perhaps its containing div needs a better CSS size.

Could you have possibly called dispose() on the BitmapData somewhere else in your code? Once a BitmapData has been disposed, it should not be used for drawing anymore.

Another possibility is that the width or height of the DisplayObject might be 0, which would result in invalid BitmapData.

As I said, the same code with no changes, works on version 9.2.0 but hangs on 9.4.2.

Did you call BitmapData.fromTexture()?

Have you tried OpenFL 9.5.0? When I try to run your code in 9.4.2, I see some WebGL warnings. However, I don’t see any warnings with 9.5.0.

I tested 5 minutes ago, and yes. The problem still exists.

Well, unfortunately, the code that you supplied isn’t enough to reproduce the issue on my machine. We’re going to need some more information from you to be able to fix this. That is why I asked you to check whether any BitmapData might have been disposed, or whether its width or height might be 0. To try to gather more information or clues about what might be going wrong. There may be a new bug in OpenFL that didn’t exist in 9.2.0. It’s also possible that 9.2.0 had a bug that allowed you to do certain things that should have been restricted, and the latest OpenFL now correctly prevents that. I hope that you can share a more complete example so we can figure out which it is.

no, I do not use textures. Just Plain BitmapData. I will try to check again if I make a Dispose somewhere in the code to check out if that is the problem. At first I could say I traced for width and Height inside the function and it never returns 0. in fact there is no log in the console, previous to the Exception. I am working now on several other bugs with High priority, but I have to solve this since it is important to be able to be updated in versions.

Track whether the return value of bmd.getPixels() is invalid. If the return value length is 0, calling bmd.dispose() and setPixels() will result in a perfect width and height of 0.