Changeset 1075 for branches/0.7-stable


Ignore:
Timestamp:
Jun 7, 2010, 5:57:58 AM (11 years ago)
Author:
Peter Johansson
Message:

Fixes severe bug that we allowed copy construction of StatsCollection?
(compiler generated), which involved copying of pointers, which were
deleted in destructor, i.e., we allowed multiple deletion.

Location:
branches/0.7-stable
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/0.7-stable/bin/svndigest.cc

    r847 r1075  
    152152  if (option->verbose())
    153153    std::cout << "Parsing directory tree" << std::endl;
    154   StatsCollection stats(tree->parse(option->verbose(), option->ignore_cache()));
     154  const StatsCollection& stats(tree->parse(option->verbose(),
     155                                           option->ignore_cache()));
    155156
    156157  if (option->report()) {
  • branches/0.7-stable/lib/StatsCollection.cc

    r847 r1075  
    5151  StatsCollection::~StatsCollection(void)
    5252  {
    53     for (map::const_iterator i(stats_.begin()); i!=stats_.end(); ++i) {
     53    for (map::iterator i(stats_.begin()); i!=stats_.end(); ++i) {
    5454      assert(i->second);
    5555      delete i->second;
     56      i->second = NULL;
    5657    }
    57 
    5858  }
    5959
  • branches/0.7-stable/lib/StatsCollection.h

    r847 r1075  
    8686
    8787  private:
     88    // copy not allowed
     89    StatsCollection(const StatsCollection&);
     90    StatsCollection& operator=(const StatsCollection&);
     91
    8892    const std::string path_;
    8993    typedef std::map<std::string, Stats*> map;
Note: See TracChangeset for help on using the changeset viewer.