-
-
Notifications
You must be signed in to change notification settings - Fork 377
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Thread-related crashes when triggering HaxeObject callbacks from Java code in a Lime/OpenFL Extension #983
Comments
Update to the above: using a Still would be nice to have a Handler to switch to the Haxe thread for Java > Haxe callbacks though I think? |
I believe the purpose of Does it make a difference if it is static, or how do you think it needs to change? |
Looking through the Java source code templates in lime I think there are 2 cases that need to be covered:
The So my current thinking is that we need another I'm not sure how we could implement this "correctly" though given that |
Is there any solution for this yet? I am currently using haxe.Timer.delay call when hanlding callback from openfl extension to update openfl GUI. But not sure if it works. |
Having looked into this, a The solution, therefore, is to use the loop we have. You can do this with |
Or not. This is exactly why you don't try to run two event loops on the same thread. Each tries to loop forever, while expecting the other to return at regular intervals. So... |
Actually, I know lime haxe.Timer is not thread safe, but I modified it to be thread safe with Mutex. Just need to modify 2 files:
Also, for extensionkit, modify ExtensionKit.hx, method CreateAndDispatchEvent to use haxe.Timer Still, this is just my solution for hxcpp. Just FYI. |
Right, I was looking at the wrong version of I'm currently sitting on a pull request to make |
Pull request submitted! |
Sorry to ask this here, I dont know where to ask. So, I have an android app using openfl. That app has a thread. The thread simply does null access.
********** Crash dump: ********** dont payattention to ENTThread name. It is actually this I copied the content over because I use old haxe (4.0.5) while I need to use eventloop feature of latest haxe Thread. So, as you can see, it trace right to line 130 in the Thread.hx file, but not my null access line. So, not sure what I need to do so that ndk-stack does trace to exact cpp code line that cause program crash. My question may be demonstrated like the following question https://community.haxe.org/t/cpp-target-crashes-without-any-error-messages/2785/4 |
Check in /data/tombstones for more detailed crash dumps. $ adb shell ls /data/tombstones
tombstone_01 tombstone_02 tombstone_03 tombstone_04
tombstone_05 tombstone_06
$ adb pull /data/tombstones/tombstone_06 tombstone_06
$ ndk-stack -i tombstone_06 -sym . |
Yes. I did use tombstone. But still, no info related to the crash line in the thread_func. So, not sure what I am missing. @@ |
Then I think it's time to break out lldb. Recall that Export/android/bin is a fully-functional Android project that Android Studio can open, so in theory the instructions should work as written. |
Ok. Thank you. |
Oh wait, I just went and re-read your use case. All this time I thought you were debugging a specific error that only happened on Android, rather than trying to figure out how to approach the problem for future reference. For future reference, I suggest debugging the |
While upgrading some OpenFL extension libraries to work with the latest OpenFL We've run into an old issue again:
https://github.com/jgranick/openfl-native/issues/145#issuecomment-59254331
The
Extension.callbackHandler.post()
method appears to run on the Android UI thread and not the Haxe thread. Thereby using this to triggerHaxeObject
callbacks which then access OpenFL objects like the stage cause an immediate thread-related crash.The old fix was to trigger the
HaxeObject
callbacks viaGLSurfaceView.queueEvent()
, however looking through the latest source it seemsGLSurfaceView
is no longer being used and so that function is no longer available.Is there a new way to have
HaxeObject
callbacks run on the Haxe (SDLMain
?) thread instead of the Android UI thread?Or alternatively, is there a safe way to cause the desired thread switch in Haxe code? (We tried having the
HaxeObject
callback start a Timer and triggering UI changes off that, but the crash remains...)The text was updated successfully, but these errors were encountered: