subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hwri...@apache.org
Subject svn commit: r1175888 - /subversion/trunk/subversion/bindings/javahl/native/File.cpp
Date Mon, 26 Sep 2011 14:39:36 GMT
Author: hwright
Date: Mon Sep 26 14:39:36 2011
New Revision: 1175888

URL: http://svn.apache.org/viewvc?rev=1175888&view=rev
Log:
JavaHL: Fix an invalid reference problem when using the File proxy object type.

* subversion/bindings/javahl/native/File.cpp
  (File::getAbsPath): Don't release a local ref, and explain why.

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

Modified: subversion/trunk/subversion/bindings/javahl/native/File.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/File.cpp?rev=1175888&r1=1175887&r2=1175888&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/File.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/File.cpp Mon Sep 26 14:39:36 2011
@@ -79,8 +79,13 @@ const char *File::getAbsPath()
 
       stringHolder = new JNIStringHolder(jabsolutePath);
 
+      /* We don't remove the local ref for jabsolutePath here, because
+         JNIStringHolder expects that ref to be valid for the life of
+         the object, which in this case is allocated on the stack.
+         
+         So we just "leak" the reference, and it will get cleaned up when
+         we eventually exit back to Java-land. */
       env->DeleteLocalRef(clazz);
-      env->DeleteLocalRef(jabsolutePath);
     }
 
   return static_cast<const char *>(*stringHolder);



Mime
View raw message