Compare commits
No commits in common. "9f32185b78ae8f73c3c9aa34b7135d0376874a2f" and "6da0474e59d617205b55b84c3cabb441735f116e" have entirely different histories.
9f32185b78
...
6da0474e59
|
|
@ -225,15 +225,6 @@ func NewBLE() *BLE {
|
||||||
//Enable
|
//Enable
|
||||||
func (b *BLE) Enable(view uintptr) {
|
func (b *BLE) Enable(view uintptr) {
|
||||||
log.Printf("ble.Enable()")
|
log.Printf("ble.Enable()")
|
||||||
// view == 0 is Gio's detach signal (GioView.onDestroyView sends
|
|
||||||
// ViewEvent{View: 0} when the view is destroyed, e.g. the activity
|
|
||||||
// going away on a recents-wipe). Nothing to register; passing the null
|
|
||||||
// ref on would abort in JNI (GetObjectClass on null). A re-attach
|
|
||||||
// arrives as a fresh event with a live view. Callers that forward the
|
|
||||||
// event unfiltered are protected by this guard.
|
|
||||||
if view == 0 {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
setJVM(app.JavaVM())
|
setJVM(app.JavaVM())
|
||||||
runInJVM(func(env *JNIEnv) {
|
runInJVM(func(env *JNIEnv) {
|
||||||
log.Printf("ble.Enable(): inside runInJVM()")
|
log.Printf("ble.Enable(): inside runInJVM()")
|
||||||
|
|
|
||||||
|
|
@ -5,14 +5,6 @@
|
||||||
|
|
||||||
void
|
void
|
||||||
registerFragment(JNIEnv *env, jobject view) {
|
registerFragment(JNIEnv *env, jobject view) {
|
||||||
if (view == NULL) {
|
|
||||||
// Detach signal (Gio sends ViewEvent{View: 0} when the view is
|
|
||||||
// destroyed, e.g. the activity going away on a recents-wipe).
|
|
||||||
// The Go side already filters these; this guard keeps the JNI
|
|
||||||
// calls safe if one ever slips through (GetObjectClass on null
|
|
||||||
// aborts the process).
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
jclass cls = (*env)->GetObjectClass(env, view);
|
jclass cls = (*env)->GetObjectClass(env, view);
|
||||||
jmethodID mid = (*env)->GetMethodID(env, cls, "getContext", "()Landroid/content/Context;");
|
jmethodID mid = (*env)->GetMethodID(env, cls, "getContext", "()Landroid/content/Context;");
|
||||||
jobject ctx = (*env)->CallObjectMethod(env, view, mid);
|
jobject ctx = (*env)->CallObjectMethod(env, view, mid);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user