[btree_damage_tracker] Initialise all path_tracker objects with a null path.
This fixes an insidious bug that took me ages to track down. Without it the non-existent front() of a list was sometimes being accessed.
This commit is contained in:
parent
1a632f9d53
commit
feb8a03d5f
@ -85,12 +85,17 @@ namespace persistent_data {
|
||||
// different sub tree (by looking at the btree_path).
|
||||
class path_tracker {
|
||||
public:
|
||||
path_tracker() {
|
||||
// We push an empty path, to ensure there
|
||||
// is always a current_path.
|
||||
paths_.push_back(btree_path());
|
||||
}
|
||||
|
||||
// returns the old path if the tree has changed.
|
||||
btree_path const *next_path(btree_path const &p) {
|
||||
if (p != current_path()) {
|
||||
if (paths_.size() == 2)
|
||||
paths_.pop_front();
|
||||
|
||||
paths_.push_back(p);
|
||||
|
||||
return &paths_.front();
|
||||
|
Loading…
Reference in New Issue
Block a user