harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gshiman...@apache.org
Subject svn commit: r549823 - /harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni.cpp
Date Fri, 22 Jun 2007 14:12:01 GMT
Author: gshimansky
Date: Fri Jun 22 07:12:00 2007
New Revision: 549823

URL: http://svn.apache.org/viewvc?view=rev&rev=549823
Log:
Applied patch from HARMONY-4075
[drlvm][util] It isn't possible to kill DLRVM with Ctrl-C in some conditions


Modified:
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni.cpp

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni.cpp?view=diff&rev=549823&r1=549822&r2=549823
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/jni/jni.cpp Fri Jun 22 07:12:00 2007
@@ -414,7 +414,6 @@
                                                jsize bufLen,
                                                jsize * nVMs)
 {
-
     jint status = jni_init();
     if (status != JNI_OK) {
         return status;
@@ -443,7 +442,7 @@
     JavaVMInitArgs * vm_args;
     JavaVM_Internal * java_vm;
     Global_Env * vm_env;
-    apr_pool_t * vm_global_pool;
+    apr_pool_t * vm_global_pool = NULL;
     jthread java_thread;
     jint status;
 
@@ -552,6 +551,11 @@
     status  = JNI_OK;
 done:
     apr_thread_mutex_unlock(GLOBAL_LOCK);
+
+    if (status != JNI_OK && NULL != vm_global_pool) {
+        apr_pool_destroy(vm_global_pool);
+    }
+
     return status;
 }
 
@@ -1469,12 +1473,14 @@
     assert(java_thread != NULL);
 
     apr_thread_mutex_lock(GLOBAL_LOCK);
-    
-    status = vm_destroy(java_vm, java_thread);
 
     // Remove current VM from the list of all VMs running in the current adress space.
     APR_RING_REMOVE(java_vm, link);
     
+    apr_thread_mutex_unlock(GLOBAL_LOCK);
+
+    status = vm_destroy(java_vm, java_thread);
+
     // Destroy VM environment.
     delete java_vm->vm_env;
     java_vm->vm_env = NULL;
@@ -1482,8 +1488,6 @@
     // Destroy VM pool.
     apr_pool_destroy(java_vm->pool);
 
-    apr_thread_mutex_unlock(GLOBAL_LOCK);
-    
     return status;
 }
 



Mime
View raw message