You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by br...@apache.org on 2014/01/14 12:49:23 UTC
svn commit: r1558015 - in
/subversion/trunk/subversion/bindings/javahl/native: Prompter.cpp
Prompter.h SVNClient.cpp
Author: brane
Date: Tue Jan 14 11:49:23 2014
New Revision: 1558015
URL: http://svn.apache.org/r1558015
Log:
Make sure that the Java callback object won't get garbage-collected while
an RA session is still using it.
[in subversion/bindings/javahl]
* native/Prompter.h (Prompter::Prompter): Make copy constructor private.
(Prompter::makeCPrompter): Declare a copying factory
* native/Prompter.cpp (Prompter::makeCPrompter): Implement the copying
factory so that it creates a new global reference to the Java prompter.
* native/SVNClient.cpp (SVNClient::openRemoteSession): Use the copying factory.
Modified:
subversion/trunk/subversion/bindings/javahl/native/Prompter.cpp
subversion/trunk/subversion/bindings/javahl/native/Prompter.h
subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp
Modified: subversion/trunk/subversion/bindings/javahl/native/Prompter.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/Prompter.cpp?rev=1558015&r1=1558014&r2=1558015&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/Prompter.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/Prompter.cpp Tue Jan 14 11:49:23 2014
@@ -94,6 +94,11 @@ Prompter *Prompter::makeCPrompter(jobjec
return new Prompter(myPrompt);
}
+Prompter *Prompter::makeCPrompter(const Prompter& prompter)
+{
+ return makeCPrompter(prompter.m_prompter);
+}
+
/**
* Retrieve the username from the Java object
* @return Java string for the username or NULL
Modified: subversion/trunk/subversion/bindings/javahl/native/Prompter.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/Prompter.h?rev=1558015&r1=1558014&r2=1558015&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/Prompter.h (original)
+++ subversion/trunk/subversion/bindings/javahl/native/Prompter.h Tue Jan 14 11:49:23 2014
@@ -55,6 +55,8 @@ class Prompter
bool m_maySave;
Prompter(jobject jprompter);
+ Prompter(const Prompter&) {}
+
bool prompt(const char *realm, const char *pi_username, bool maySave);
bool askYesNo(const char *realm, const char *question, bool yesIsDefault);
const char *askQuestion(const char *realm, const char *question,
@@ -95,6 +97,7 @@ class Prompter
apr_pool_t *pool);
public:
static Prompter *makeCPrompter(jobject jprompter);
+ static Prompter *makeCPrompter(const Prompter& prompter);
~Prompter();
svn_auth_provider_object_t *getProviderUsername(SVN::Pool &in_pool);
svn_auth_provider_object_t *getProviderSimple(SVN::Pool &in_pool);
Modified: subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp?rev=1558015&r1=1558014&r2=1558015&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp Tue Jan 14 11:49:23 2014
@@ -1510,7 +1510,7 @@ SVNClient::openRemoteSession(const char*
/* Decouple the RemoteSession's context from SVNClient's context
by creating a copy of the prompter here. */
- Prompter* prompter = new Prompter(context.getPrompter());
+ Prompter* prompter = Prompter::makeCPrompter(context.getPrompter());
if (!prompter)
return NULL;