Openfl 4.5.2 : android random crash

Hi,

I tried update to openfl 4.5.2, but my game got random crash if I tried to change parent or position a sprite.

In openfl 4.4.1 my game working fine (same game).

I hope this issue can be fix in the next update version

Thanks,
Stendy

Can you provide some sample code that causes the error?

Here’s the example code :

	a = new Sprite();
	a.graphics.beginFill(0xFF0000, 1);
	a.graphics.drawRect(0, 0, 200, 200);
	a.x = 0;
	a.y = 0;
	addChild(a);

	b = new Sprite();
	b.graphics.beginFill(0xFF0000, 1);
	b.graphics.drawRect(0, 0, 200, 200);
	b.x = 300;
	b.y = 0;
	addChild(b);	
	
	c = new Bitmap (Assets.getBitmapData(imgFolder + "/" + imgName));
	
	c.x = 0;
	c.y = 0;
	a.addChild(c);			
	
	addEventListener(MouseEvent.CLICK, onClick, false, 0, true);

        private function onClick(e:MouseEvent) {
	      a.removeChild(c);
	
	      c.x = 50;
	      c.y = 50;
	      b.addChild(c);		
        }

If I try the code above on clean / new project, there is no crash. But If try it to finished project that already implement admob, chartboost, and etc that code causing crash.

So my game project working fine with openfl 4.4.1, after I tried update to 4.5.2 my game always got “unfornately has been stopped” if I accessing parent / position a sprite.

Do you have an extension that calls back into Haxe on the wrong thread?

I already tried remove all extension except openfl, actuate, and spritesheet. The result still crashed on my game project. My game project running fine with 4.4.1

Do you know what line crashes?

BTW, this code crashes on Flash Player if onClick is called more than once

Here’s the log crash debug :

Yes, that’s only an example code.

You can often get more information about SIGSEGV by adding these to your project.xml file:

<haxedef name="HXCPP_CHECK_POINTER" if="debug" />
<haxedef name="HXCPP_STACK_LINE" if="debug" />

After adding that line, what should I do next?

what information that you need with adding that line?

Here’s the log result after adding those line :

Are you running a debug build? Do you get any output from Haxe before this occurs, such as a stack trace?

If not, can you add traces to your code, so you know which lines cause the crash?

Thank you :slight_smile:

Normally you’d get a stack trace above this. Scroll up a little and see if you find any line numbers. (Also, as Joshua said, make sure you’re running a debug build.)

OK, I found the error line :

Simplebutton.hx line 179.

Is that you looking for?

Anyway I already try with the new version 4.5.3 and the result still same.

Or do you want me to send my project file? So you can find what’s wrong when build with 4.5.3 version?

Thanks, that’s super helpful

https://github.com/openfl/openfl/blob/develop/openfl/display/SimpleButton.hx#L179

Perhaps you could add a few trace messages before this line, so we could see what is causing the null reference error?

trace (hitTestState == null);
trace (stack == null);
trace (hitObject == null);

Perhaps it is an error from a null hitObject

Here’s the result :

	trace("hitTestState = " + (hitTestState == null));
	trace("stack = " + (stack == null));
	trace("hitObject = " + (hitObject == null));
	trace("shapeFlag = " + shapeFlag);
	trace("stack = " + stack);
	trace("interactiveOnly = " + interactiveOnly);

What version of Haxe are you using? I’ve been having some trouble on C++ with Haxe 3.4

Try using adb logcat from the command line. Usually it prints out an entire stack trace, not just one line.

I’m using haxe 3.2.1

Last time I tried to use adb logcat the output made me confuse because I can’t filtered it.

If it helps, you can filter the output.

Windows:

> adb logcat | findstr "HXCPP"

Mac or Linux:

$ adb logcat | grep "HXCPP"
1 Like