haxeui / haxeui-kha

The Kha backend of the HaxeUI framework -
http://haxeui.org
MIT License
45 stars 16 forks source link

Image.fromEncodedBytes fails in Krom target #35

Open mundusnine opened 5 years ago

mundusnine commented 5 years ago

Expected Behavior

Get image files

Current Behavior

The bytes are loaded from haxe.Resources but when trying to get the Image object from kha we get crapped data. This seems to be caused by the Js engine that recycles the data before we get it back. Hence, we get data that is null. Here is the output:

 Trace: TypeError: Cannot read property 'width' of null
    at $hxClasses.kha.Image.get_realWidth (<anonymous>:50598:30)
    at <anonymous>:8490:36
    at Function.kha_Image.fromEncodedBytes (<anonymous>:50448:2)
    at $hxClasses.haxe.ui.ToolkitAssets.imageFromBytes (<anonymous>:8489:13)
    at $hxClasses.haxe.ui.ToolkitAssets.getImageFromHaxeResource (<anonymous>:8484:8)
    at <anonymous>:8634:14
    at $hxClasses.haxe.ui.ToolkitAssets.getImageInternal (<anonymous>:8479:4)
    at $hxClasses.haxe.ui.ToolkitAssets.getImage (<anonymous>:8628:10)
    at $hxClasses.haxe.ui.util.ImageLoader.load (<anonymous>:31113:33)
    at $hxClasses.haxe.ui.components._Image.ResourceBehaviour.validateData (<anonymous>:14510:15)
Trace: TypeError: Cannot read property 'width' of null
    at $hxClasses.kha.Image.get_realWidth (<anonymous>:50598:30)
    at <anonymous>:8490:36
    at Function.kha_Image.fromEncodedBytes (<anonymous>:50448:2)
    at $hxClasses.haxe.ui.ToolkitAssets.imageFromBytes (<anonymous>:8489:13)
    at $hxClasses.haxe.ui.ToolkitAssets.getImageFromHaxeResource (<anonymous>:8484:8)
    at <anonymous>:8634:14
    at $hxClasses.haxe.ui.ToolkitAssets.getImageInternal (<anonymous>:8479:4)
    at $hxClasses.haxe.ui.ToolkitAssets.getImage (<anonymous>:8628:10)
    at $hxClasses.haxe.ui.util.ImageLoader.load (<anonymous>:31113:33)
    at $hxClasses.haxe.ui.components._Image.ResourceBehaviour.validateData (<anonymous>:14510:15)

Possible Solution

This pull request removes the issue in the short-term. In the long-term this issue needs to be investigated in Krom.

Steps to Reproduce (for bugs)

  1. Have a dialog be visible(the X to close the window is an image so you should crash)

Context

Have a dialog open

Your Environment

This issue happens only in

ianharrigan commented 5 years ago

Can this be closed now? Is this issue logged somewhere with Robert?

EDIT: oh yeah, i see it in Krom repo now +1