mirror of
https://github.com/netbirdio/gomobile-tvos-fork.git
synced 2026-05-22 18:43:29 -07:00
mobile/bind: fix JNI local reference table overflow
The existing implementation has memory leaks on two local variables that are not deleted after use. Android app will crash after this issue. add UnitTest for this issue. Fixes golang/go#14346 Change-Id: Ic233d15556ac97b35e00e13279a572c48a03049f Reviewed-on: https://go-review.googlesource.com/19532 Reviewed-by: Elias Naur <elias.naur@gmail.com>
This commit is contained in:
+12
-2
@@ -4,10 +4,9 @@
|
||||
|
||||
package go;
|
||||
|
||||
import android.util.Log;
|
||||
import android.test.suitebuilder.annotation.Suppress;
|
||||
import android.test.AndroidTestCase;
|
||||
import android.test.MoreAsserts;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Random;
|
||||
|
||||
@@ -386,6 +385,17 @@ public class SeqTest extends AndroidTestCase {
|
||||
assertEquals("want back the error message we set", want, got);
|
||||
}
|
||||
|
||||
//test if we have JNI local reference table overflow error
|
||||
public void testLocalReferenceOverflow() {
|
||||
Testpkg.CallWithCallback(new Testpkg.GoCallback.Stub() {
|
||||
|
||||
@Override
|
||||
public void VarUpdate() {
|
||||
//do nothing
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void testNullReferences() {
|
||||
assertTrue(Testpkg.CallWithNull(null, new Testpkg.NullTest.Stub() {
|
||||
public Testpkg.NullTest Null() {
|
||||
|
||||
Reference in New Issue
Block a user