Various iOS / Mac64 crashes

Hi - I have a few bugs I believe I’ve uncovered, but I’m not sure which project is the issue (hxcpp, lime, openfl, haxe). I’m on Haxe 3.2.0, OpenFL 3.3.8, Lime 2.6.8, hxcpp 3.2.180. Also, I’m using -Dlegacy.

The first bug caused a crash on OSX. Here’s basically what I was doing:

var o = Factory.text (...) // returns an openfl.text.TextField
addChild (o);
o = Factory.sprite (...); // returns an openfl.sprite.Sprite
addChild (o);

The reuse of ‘o’ as a different type caused a null pointer exception. I solved it by using a different, new variable instead of reusing ‘o’.

Similarly, I had a crash on iOS that fired during a MOUSE_DOWN event. My function looked like this:

private function onmousedown (ev) {
  if (ev.target == buttonSprite) {
    // ...
  }
}

But ev.target was returning null. I set the type explicitly and the crash went away.

private function onmousedown (ev : MouseEvent) {

These two seem related - loss of typing results in null. Strangely, this all worked fine under Neko.

At any rate, thanks for OpenFL!

Would you mind trying with HXCPP 3.2.102?

haxelib install hxcpp 3.2.102
haxelib set hxcpp 3.2.102
lime test mac -Dlegacy

Both bugs appear to manifest themselves when I build with HXCPP 3.2.102.

Thanks for checking in!

Oh, in the first case, does var o:DisplayObject or doing var o both times fix it?

The second one is weird