Author: hwright
Date: Fri Sep 30 15:40:18 2011
New Revision: 1177702

URL: http://svn.apache.org/viewvc?rev=1177702&view=rev
Log:
JavaHL: Don't cleanup from within the Array proxy object, and leave a comment
as to why.

* subversion/bindings/javahl/native/Array.cpp
  (~Array): As above.

Modified:
    subversion/trunk/subversion/bindings/javahl/native/Array.cpp

Modified: subversion/trunk/subversion/bindings/javahl/native/Array.cpp
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/Array.cpp?rev=1177702&r1=1177701&r2=1177702&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/Array.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/Array.cpp Fri Sep 30 
15:40:18 2011
@@ -33,16 +33,13 @@
 
 Array::~Array()
 {
-  if (m_objectArray != NULL)
-    {
-      for (std::vector<jobject>::iterator it = m_objects.begin();
-            it < m_objects.end(); ++it)
-        {
-          JNIUtil::getEnv()->DeleteLocalRef(*it);
-        }
-
-      JNIUtil::getEnv()->DeleteLocalRef(m_objectArray);
-    }
+  /* We don't clean up our Java object here, because this destructor may run
+     *after* a call to PopLocalFrame().  If so, we would be deleting references
+     twice, which leads to all kinds of problems.
+
+     Instead, we intentionally "leak" these references, knowing that a call
+     to PopLocalFrame() will clean them up, or, in the worse case, the JVM
+     will clean them up when it returns from the JNI code. */
 }
 
 const std::vector<jobject> &Array::vector(void) const


Reply via email to