[everything] Fix circular shared pointer references.
We had a cycle from transaction_manager <-> space_map, and also from the ref_counters back up to the tm. This prevented objects being destroyed when various programs exited. From now on we'll try and only use a shared ptr if ownership is implied. Otherwise a reference will be used (eg, for up pointers).
This commit is contained in:
@ -122,7 +122,7 @@ thin_pool::create_thin(thin_dev_t dev)
|
||||
if (device_exists(dev))
|
||||
throw std::runtime_error("Device already exists");
|
||||
|
||||
single_mapping_tree::ptr new_tree(new single_mapping_tree(md_->tm_,
|
||||
single_mapping_tree::ptr new_tree(new single_mapping_tree(*md_->tm_,
|
||||
mapping_tree_detail::block_time_ref_counter(md_->data_sm_)));
|
||||
md_->mappings_top_level_->insert(key, new_tree->get_root());
|
||||
md_->mappings_->set_root(md_->mappings_top_level_->get_root()); // FIXME: ugly
|
||||
@ -140,7 +140,7 @@ thin_pool::create_snap(thin_dev_t dev, thin_dev_t origin)
|
||||
if (!mtree_root)
|
||||
throw std::runtime_error("unknown origin");
|
||||
|
||||
single_mapping_tree otree(md_->tm_, *mtree_root,
|
||||
single_mapping_tree otree(*md_->tm_, *mtree_root,
|
||||
mapping_tree_detail::block_time_ref_counter(md_->data_sm_));
|
||||
|
||||
single_mapping_tree::ptr clone(otree.clone());
|
||||
|
Reference in New Issue
Block a user