I get an error of -> Segmentation fault while accessing address 0x00007ff8bf611980 (_ZNSt10_weakptrIN10prometheus11CollectableELN9_gnu_cxx12_Lock_policyE2EEC1ERKS4_+0x1b) [0x7fff8bee28215]
My code lies below-
void Family::MakeGauge3(std::string s1, std::string s2, const
std::map<string,string>& labels, MyExposer* ex)
{ auto registry = make_shared<Registry>();
gauge_family= &(BuildGauge().Name(s1).Help(s2).
Labels(labels).Register(*registry));
ex->register(registry); //problematic line
}
The register function in the MyExposer class is->
void Exposer::register(std::shared_ptr<Registry> reg)
{
exp ->RegisterCollectable(reg);
}
exp is a private member of class MyExposer defined as->
Exposer* exp; //Exposer is another class
void Exposer::RegisterCollectable(const std::weak_ptr<Collectable>&
collectable)
{ collectables_.push_back(collectable);
}
where collectable_is a private member defined in Exposer class as->
std::vector<std::weak_ptr<Collectable>> collectables_;
Aucun commentaire:
Enregistrer un commentaire