Author: vmpn
Date: Tue May 29 01:48:55 2012
New Revision: 1343450
URL: http://svn.apache.org/viewvc?rev=1343450&view=rev
Log:
On the javahl-ra branch:
Merge r1342810 from trunk and bring SVNReposAccess up to date with it.
JavaHL: Explicitly pass jobject jthis when processing dispose() call rather
than stashing a reference in the SVNBase class where it can be missused later
[ in subversion/bindings/javahl/native ]
* SVNReposAccess.cpp,
SVNReposAccess.h
(dispose): Accept object jthis as explicit parameter and pass it to
SVNBase::dispose
* org_apache_subversion_javahl_SVNReposAccess.cpp
(Java_org_apache_subversion_javahl_SVNReposAccess_dispose): Pass object jthis
as explicit parameter and pass it to the C++ wrapper class
Modified:
subversion/branches/javahl-ra/ (props changed)
subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNBase.cpp
subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNBase.h
subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNClient.cpp
subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNClient.h
subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNRepos.cpp
subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNRepos.h
subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNReposAccess.cpp
subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNReposAccess.h
subversion/branches/javahl-ra/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp
subversion/branches/javahl-ra/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNRepos.cpp
subversion/branches/javahl-ra/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNReposAccess.cpp
Propchange: subversion/branches/javahl-ra/
------------------------------------------------------------------------------
Merged /subversion/trunk:r1342810
Modified:
subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNBase.cpp
URL:
http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNBase.cpp?rev=1343450&r1=1343449&r2=1343450&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNBase.cpp
(original)
+++ subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNBase.cpp
Tue May 29 01:48:55 2012
@@ -30,7 +30,6 @@
SVNBase::SVNBase()
: pool(JNIUtil::getPool())
{
- jthis = NULL;
}
SVNBase::~SVNBase()
@@ -58,17 +57,6 @@ jlong SVNBase::findCppAddrForJObject(job
if (JNIUtil::isJavaExceptionThrown())
return 0;
- if (cppAddr)
- {
- /* jthis is not guaranteed to be the same between JNI invocations, so
- we do a little dance here and store the updated version in our
- object for this invocation.
-
- findCppAddrForJObject() is, by necessity, called before any other
- methods on the C++ object, so by doing this we can guarantee a
- valid jthis pointer for subsequent uses. */
- (reinterpret_cast<SVNBase *> (cppAddr))->jthis = jthis;
- }
return cppAddr;
}
}
@@ -82,17 +70,15 @@ void SVNBase::finalize()
JNIUtil::enqueueForDeletion(this);
}
-void SVNBase::dispose(jfieldID *fid, const char *className)
+void SVNBase::dispose(jobject jthis, jfieldID *fid, const char *className)
{
- jobject my_jthis = this->jthis;
-
delete this;
JNIEnv *env = JNIUtil::getEnv();
SVNBase::findCppAddrFieldID(fid, className, env);
if (*fid == 0)
return;
- env->SetLongField(my_jthis, *fid, 0);
+ env->SetLongField(jthis, *fid, 0);
if (JNIUtil::isJavaExceptionThrown())
return;
}
Modified:
subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNBase.h
URL:
http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNBase.h?rev=1343450&r1=1343449&r2=1343450&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNBase.h
(original)
+++ subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNBase.h
Tue May 29 01:48:55 2012
@@ -49,7 +49,7 @@ class SVNBase
*
* @since 1.4.0
*/
- virtual void dispose() = 0;
+ virtual void dispose(jobject jthis) = 0;
/**
* This method should never be called, as @c dispose() should be
@@ -80,13 +80,7 @@ class SVNBase
*
* @since 1.4.0
*/
- void dispose(jfieldID *fid, const char *className);
-
- /**
- * A pointer to the parent java object. This is not valid across JNI
- * method invocations, and so should be set in each one.
- */
- jobject jthis;
+ void dispose(jobject jthis, jfieldID *fid, const char *className);
private:
/**
Modified:
subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNClient.cpp
URL:
http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNClient.cpp?rev=1343450&r1=1343449&r2=1343450&view=diff
==============================================================================
---
subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNClient.cpp
(original)
+++
subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNClient.cpp
Tue May 29 01:48:55 2012
@@ -86,10 +86,10 @@ SVNClient *SVNClient::getCppObject(jobje
return (cppAddr == 0 ? NULL : reinterpret_cast<SVNClient *>(cppAddr));
}
-void SVNClient::dispose()
+void SVNClient::dispose(jobject jthis)
{
static jfieldID fid = 0;
- SVNBase::dispose(&fid, JAVA_PACKAGE"/SVNClient");
+ SVNBase::dispose(jthis, &fid, JAVA_PACKAGE"/SVNClient");
}
jstring SVNClient::getAdminDirectoryName()
Modified:
subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNClient.h
URL:
http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNClient.h?rev=1343450&r1=1343449&r2=1343450&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNClient.h
(original)
+++ subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNClient.h
Tue May 29 01:48:55 2012
@@ -196,7 +196,7 @@ class SVNClient :public SVNBase
ClientContext &getClientContext();
const char *getLastPath();
- void dispose();
+ void dispose(jobject jthis);
static SVNClient *getCppObject(jobject jthis);
SVNClient(jobject jthis_in);
virtual ~SVNClient();
Modified:
subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNRepos.cpp
URL:
http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNRepos.cpp?rev=1343450&r1=1343449&r2=1343450&view=diff
==============================================================================
---
subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNRepos.cpp
(original)
+++
subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNRepos.cpp
Tue May 29 01:48:55 2012
@@ -54,10 +54,10 @@ SVNRepos *SVNRepos::getCppObject(jobject
return (cppAddr == 0 ? NULL : reinterpret_cast<SVNRepos *>(cppAddr));
}
-void SVNRepos::dispose()
+void SVNRepos::dispose(jobject jthis)
{
static jfieldID fid = 0;
- SVNBase::dispose(&fid, JAVA_PACKAGE"/SVNRepos");
+ SVNBase::dispose(jthis, &fid, JAVA_PACKAGE"/SVNRepos");
}
void SVNRepos::cancelOperation()
Modified:
subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNRepos.h
URL:
http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNRepos.h?rev=1343450&r1=1343449&r2=1343450&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNRepos.h
(original)
+++ subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNRepos.h
Tue May 29 01:48:55 2012
@@ -69,7 +69,7 @@ class SVNRepos : public SVNBase
void pack(File &path, ReposNotifyCallback *callback);
SVNRepos();
virtual ~SVNRepos();
- void dispose();
+ void dispose(jobject jthis);
static SVNRepos *getCppObject(jobject jthis);
static svn_error_t *checkCancel(void *cancelBaton);
Modified:
subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNReposAccess.cpp
URL:
http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNReposAccess.cpp?rev=1343450&r1=1343449&r2=1343450&view=diff
==============================================================================
---
subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNReposAccess.cpp
(original)
+++
subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNReposAccess.cpp
Tue May 29 01:48:55 2012
@@ -60,10 +60,10 @@ SVNReposAccess *SVNReposAccess::getCppOb
return (cppAddr == 0 ? NULL : reinterpret_cast<SVNReposAccess *>(cppAddr));
}
-void SVNReposAccess::dispose()
+void SVNReposAccess::dispose(jobject jthis)
{
static jfieldID fid = 0;
- SVNBase::dispose(&fid, JAVA_PACKAGE"/SVNReposAccess");
+ SVNBase::dispose(jthis, &fid, JAVA_PACKAGE"/SVNReposAccess");
}
svn_revnum_t
Modified:
subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNReposAccess.h
URL:
http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNReposAccess.h?rev=1343450&r1=1343449&r2=1343450&view=diff
==============================================================================
---
subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNReposAccess.h
(original)
+++
subversion/branches/javahl-ra/subversion/bindings/javahl/native/SVNReposAccess.h
Tue May 29 01:48:55 2012
@@ -42,7 +42,7 @@ class SVNReposAccess : public SVNBase
SVNReposAccess(const char *repos_url);
virtual ~SVNReposAccess();
- void dispose();
+ void dispose(jobject jthis);
static SVNReposAccess *getCppObject(jobject jthis);
private:
apr_pool_t *m_sess_pool;
Modified:
subversion/branches/javahl-ra/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp
URL:
http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp?rev=1343450&r1=1343449&r2=1343450&view=diff
==============================================================================
---
subversion/branches/javahl-ra/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp
(original)
+++
subversion/branches/javahl-ra/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp
Tue May 29 01:48:55 2012
@@ -75,7 +75,7 @@ Java_org_apache_subversion_javahl_SVNCli
JNIUtil::throwError(_("bad C++ this"));
return;
}
- cl->dispose();
+ cl->dispose(jthis);
}
JNIEXPORT void JNICALL
Modified:
subversion/branches/javahl-ra/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNRepos.cpp
URL:
http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNRepos.cpp?rev=1343450&r1=1343449&r2=1343450&view=diff
==============================================================================
---
subversion/branches/javahl-ra/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNRepos.cpp
(original)
+++
subversion/branches/javahl-ra/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNRepos.cpp
Tue May 29 01:48:55 2012
@@ -60,7 +60,7 @@ Java_org_apache_subversion_javahl_SVNRep
JNIUtil::throwError(_("bad C++ this"));
return;
}
- cl->dispose();
+ cl->dispose(jthis);
}
JNIEXPORT void JNICALL
Modified:
subversion/branches/javahl-ra/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNReposAccess.cpp
URL:
http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNReposAccess.cpp?rev=1343450&r1=1343449&r2=1343450&view=diff
==============================================================================
---
subversion/branches/javahl-ra/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNReposAccess.cpp
(original)
+++
subversion/branches/javahl-ra/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNReposAccess.cpp
Tue May 29 01:48:55 2012
@@ -62,7 +62,7 @@ Java_org_apache_subversion_javahl_SVNRep
JNIUtil::throwError(_("bad C++ this"));
return;
}
- ra->dispose();
+ ra->dispose(jthis);
}
JNIEXPORT void JNICALL