Changeset 1219


Ignore:
Timestamp:
Oct 12, 2010, 4:37:53 AM (10 years ago)
Author:
Peter Johansson
Message:

closes #371. SVNException copy with ref counter.

Location:
trunk/lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/SVN.cc

    r1218 r1219  
    4646
    4747  SVNException::SVNException(const std::string& msg, svn_error_t* error)
    48     : std::runtime_error(""), error_(error), msg_(msg) {}
    49 
    50 
    51   SVNException::~SVNException(void) throw() {}
     48    : std::runtime_error(""), error_(error), msg_(msg)
     49  {
     50    ref_count_ = new int(1);
     51  }
     52
     53  SVNException::SVNException(const SVNException& other)
     54    : std::runtime_error(other), error_(other.error_), msg_(other.msg_),
     55      ref_count_(other.ref_count_)
     56  {
     57    ++(*ref_count_);
     58  }
     59
     60
     61  SVNException::~SVNException(void) throw()
     62  {
     63    --ref_count_;
     64    if (!ref_count_) {
     65      delete ref_count_;
     66      ref_count_=NULL;
     67      svn_error_clear(error_);
     68      error_=SVN_NO_ERROR;
     69    }
     70  }
    5271
    5372
  • trunk/lib/SVN.h

    r1218 r1219  
    5353    SVNException(const std::string& msg, svn_error_t* error=NULL);
    5454
     55    /**
     56       Copy constructor
     57     */
     58    SVNException(const SVNException& other);
     59
     60    /**
     61       Destructor
     62     */
    5563    virtual ~SVNException(void) throw();
     64
    5665    /**
    5766       override base implementation
     
    6675    svn_error_t* error_;
    6776    std::string msg_;
     77    int* ref_count_;
     78
     79    // assignment not allowed
     80    SVNException& operator=(const SVNException&);
    6881  };
    6982
Note: See TracChangeset for help on using the changeset viewer.