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 2015/04/18 19:01:48 UTC
svn commit: r1674541 - in
/subversion/trunk/subversion/bindings/javahl/native: EditorProxy.h
RemoteSession.cpp StateReporter.cpp StateReporter.h
Author: brane
Date: Sat Apr 18 17:01:48 2015
New Revision: 1674541
URL: http://svn.apache.org/r1674541
Log:
In JavaHL, use a standard smart pointer to control the status editor proxy
instead of relying on manual celanup.
[in subversion/bindings/javahl/native]
* EditorProxy.h: Include <memory>.
(EditorProxy::UniquePtr): New typedef.
* RemoteSession.cpp
(RemoteSession::status): Use the new typedef instead of std:auto_ptr.
* StateReporter.h
(StateReporter): Use the new typedef instead of a raw pointer.
(StateReporter::set_reporter_data): Likewise.
* StateReporter.cpp
(StateReporter::~StateReporter): Remove raw pointer deletion.
(StateReporter::set_reporter_data): Update.
Modified:
subversion/trunk/subversion/bindings/javahl/native/EditorProxy.h
subversion/trunk/subversion/bindings/javahl/native/RemoteSession.cpp
subversion/trunk/subversion/bindings/javahl/native/StateReporter.cpp
subversion/trunk/subversion/bindings/javahl/native/StateReporter.h
Modified: subversion/trunk/subversion/bindings/javahl/native/EditorProxy.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/EditorProxy.h?rev=1674541&r1=1674540&r2=1674541&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/EditorProxy.h (original)
+++ subversion/trunk/subversion/bindings/javahl/native/EditorProxy.h Sat Apr 18 17:01:48 2015
@@ -27,6 +27,8 @@
#ifndef JAVAHL_EDITOR_PROXY_H
#define JAVAHL_EDITOR_PROXY_H
+#include <memory>
+
#include "svn_delta.h"
#include "private/svn_editor.h"
#include "private/svn_delta_private.h"
@@ -51,6 +53,8 @@ struct EditorProxyCallbacks
class EditorProxy
{
public:
+ typedef std::auto_ptr<EditorProxy> UniquePtr;
+
EditorProxy(jobject jeditor, apr_pool_t* edit_pool,
const char* repos_root_url, const char* base_relpath,
svn_cancel_func_t cancel_func, void* cancel_baton,
Modified: subversion/trunk/subversion/bindings/javahl/native/RemoteSession.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/RemoteSession.cpp?rev=1674541&r1=1674540&r2=1674541&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/RemoteSession.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/RemoteSession.cpp Sat Apr 18 17:01:48 2015
@@ -835,7 +835,7 @@ RemoteSession::status(jobject jthis, jst
proxy_callbacks.m_extra_baton.baton = &rp->m_target_revision;
apr_pool_t* report_pool = rp->get_report_pool();
- std::auto_ptr<EditorProxy> editor(
+ EditorProxy::UniquePtr editor(
new EditorProxy(jstatus_editor, report_pool,
repos_root_url, base_relpath,
m_context->checkCancel, m_context,
@@ -853,7 +853,7 @@ RemoteSession::status(jobject jthis, jst
editor->delta_editor(),
editor->delta_baton(),
report_pool),);
- rp->set_reporter_data(raw_reporter, report_baton, editor.release());
+ rp->set_reporter_data(raw_reporter, report_baton, editor);
}
// TODO: diff
Modified: subversion/trunk/subversion/bindings/javahl/native/StateReporter.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/StateReporter.cpp?rev=1674541&r1=1674540&r2=1674541&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/StateReporter.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/StateReporter.cpp Sat Apr 18 17:01:48 2015
@@ -43,9 +43,7 @@ StateReporter::StateReporter()
{}
StateReporter::~StateReporter()
-{
- delete m_editor;
-}
+{}
StateReporter*
StateReporter::getCppObject(jobject jthis)
@@ -179,8 +177,8 @@ StateReporter::abortReport()
void
StateReporter::set_reporter_data(const svn_ra_reporter3_t* raw_reporter,
- void* report_baton,
- EditorProxy* editor)
+ void* report_baton,
+ EditorProxy::UniquePtr editor)
{
//DEBUG:fprintf(stderr, " (n) StateReporter::set_reporter_data()\n");
Modified: subversion/trunk/subversion/bindings/javahl/native/StateReporter.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/StateReporter.h?rev=1674541&r1=1674540&r2=1674541&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/StateReporter.h (original)
+++ subversion/trunk/subversion/bindings/javahl/native/StateReporter.h Sat Apr 18 17:01:48 2015
@@ -61,13 +61,13 @@ private:
bool m_valid;
const svn_ra_reporter3_t* m_raw_reporter;
void* m_report_baton;
- EditorProxy* m_editor;
+ EditorProxy::UniquePtr m_editor;
friend class RemoteSession;
apr_pool_t* get_report_pool() const { return pool.getPool(); }
void set_reporter_data(const svn_ra_reporter3_t* raw_reporter,
void* report_baton,
- EditorProxy* editor);
+ EditorProxy::UniquePtr editor);
svn_revnum_t m_target_revision;
};