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
x/mobile/app: all example apps not working on android 4.2.2 #13741
Comments
I am getting the same crash with the basic gomobile example on 4.04, 4.2.1, 4.4 with go1.5.3 and gomobile +77ab3b7. The example runs fine on 5.0. |
@nigeltao I bisected this issue to golang/mobile@11f6745c3d563e5ed2 As far as I can tell, the call to According to the documentation here http://developer.android.com/ndk/samples/sample_na.html regarding My best guess is this results in the crash seen on 4.x and the error of trying to detach a looper that was never attached is ignored on 5.x. If this sounds right to you, then the call to /cc @hyangah |
OK, but there are two calls to C.AInputQueue_detachLooper. Are you saying that both should be removed? We also have an explicit C.AInputQueue_attachLooper call (that's attach, not detach). Does removing the detaches mean that we'll leak something? |
I noticed this when reviewing HEAD (I just submitted https://go-review.googlesource.com/#/c/20145/) where-as in the referenced commit there was only one call. What the CL does is only remove the errorneous detach call when the native activity callback is called. The input queue managed in android.go later on already processes any final events and calls detachLooper before proceeding with the new native input queue. So in theory, it shouldn't leak. But for any case I can think of that would leak would also apply to the current code as-is. |
Thanks! All examples are working now! |
Native activity callback onInputQueueCreated does not attach a looper to the input queue within android.c. Various examples of first detaching looper on the web are based around use of native_app_glue_code which does attach a looper before passing on to user callback. Calling detachLooper pre-5.0 results in a crash. I didn't track down exact source for this but code that likely made it's way into 5.0 given the time frame can be seen to show a recast of and iter over size() of a container. This possibly explains the lack of crashing for 5.0+ instead of potentially referencing a null pointer pre-5.0. Fixes golang/go#13741 Change-Id: Ie04de9f34436a95c456a56b34f1ca7e6adc00b09 Reviewed-on: https://go-review.googlesource.com/20145 Reviewed-by: Nigel Tao <nigeltao@golang.org>
Native activity callback onInputQueueCreated does not attach a looper to the input queue within android.c. Various examples of first detaching looper on the web are based around use of native_app_glue_code which does attach a looper before passing on to user callback. Calling detachLooper pre-5.0 results in a crash. I didn't track down exact source for this but code that likely made it's way into 5.0 given the time frame can be seen to show a recast of and iter over size() of a container. This possibly explains the lack of crashing for 5.0+ instead of potentially referencing a null pointer pre-5.0. Fixes golang/go#13741 Change-Id: Ie04de9f34436a95c456a56b34f1ca7e6adc00b09 Reviewed-on: https://go-review.googlesource.com/20145 Reviewed-by: Nigel Tao <nigeltao@golang.org>
All examples from golang.org/x/mobile doesnt work. I have a log:
I digged around and find, application crashes when call to C.AInputQueue_detachLooper() happened from CGO.
golang.org/x/mobile/example/gobind - works, when i build from console.
UPD: examples works on computer with Linux.
UPD: examples had worked before last updates of gomobile (or go) tool. It woked in go1.5 and gomobile (October or November release).
The text was updated successfully, but these errors were encountered: