summaryrefslogtreecommitdiff
path: root/data/jamvm/ready.diff
blob: b3ca966ff402e1551dcc7eba439a1972cda657e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
diff -ru jamvm-1.5.1/src/jni.c jamvm-1.5.1+iPhone/src/jni.c
--- jamvm-1.5.1/src/jni.c	2008-03-05 02:58:42.000000000 +0000
+++ jamvm-1.5.1+iPhone/src/jni.c	2016-01-06 11:02:02.000000000 +0000
@@ -1306,10 +1306,13 @@
     Jam_GetDirectBufferCapacity
 };
 
+static int ready = 0;
+
 jint Jam_DestroyJavaVM(JavaVM *vm) {
     mainThreadWaitToExitVM();
     exitVM(0);
 
+    ready = 0;
     return JNI_OK;
 }
 
@@ -1537,10 +1540,15 @@
     *penv = &env;
     *pvm = &invokeIntf;
 
+    ready = 1;
     return JNI_OK;
 }
 
 jint JNI_GetCreatedJavaVMs(JavaVM **buff, jsize buff_len, jsize *num) {
+    if(!ready) {
+        *num = 0;
+        return JNI_OK;
+    }
     if(buff_len > 0) {
         *buff = &invokeIntf;
         *num = 1;