[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] JavaHL: Explicitly pass jobject jthis when processing dispose() call rather than stashing a reference in the SVNBase class where it can be missused later

From: Vladimir Berezniker <vmpn_at_hitechman.com>
Date: Fri, 25 May 2012 13:35:10 -0400

Greetings,

Currently SVNBase class uses a member variable jthis to hold a copy of
jobject
reference. This variable lives as long as SVNClient object lives, however,
the
reference itself is only valid during a single JNI call. To address this
mismatch
the attached patch passes the jobject reference as a parameter instead.
This
eliminates the risk of the jobject reference being misused outside the
scope
where it is valid. This mismatch becomes more evident on JavaHL
RA editor API is implemented where objects like directories live across
method
calls.

[[[
JavaHL: Explicitly pass jobject jthis when processing dispose() call rather
 than stashing a reference in the SVNBase class where it can be misused
later

[ in subversion/bindings/javahl/native ]

* SVNBase.cpp,
  SVNBase.h
  (dispose, jthis): Accept jobject jthis as explicit parameter to dispose()
and
                    delete the member variable jthis

* SVNClient.cpp,
  SVNClient.h,
  SVNRepos.cpp,
  SVNRepos.h
  (dispose): Accept object jthis as explicit parameter and pass it to
             SVNBase::dispose

* org_apache_subversion_javahl_SVNClient.cpp,
  org_apache_subversion_javahl_SVNRepos.cpp
  (Java_org_apache_subversion_javahl_SVNClient_dispose,
   Java_org_apache_subversion_javahl_SVNRepos_dispose):
   Pass object jthis as explicit parameter and pass it to the C++ wrapper
class
]]]

Thank you,

Vladimir

Received on 2012-05-25 19:35:45 CEST

This is an archived mail posted to the Subversion Dev mailing list.