use smart pointer to avoid memory issue

This commit is contained in:
faraphel 2024-12-23 11:09:33 +01:00
parent 9c413c0edd
commit a0060c8fa8
5 changed files with 21 additions and 19 deletions

View file

@ -23,8 +23,8 @@ std::string GnsProject::getUuid() const {
return this->uuid;
}
std::vector<GnsNode> GnsProject::getNodes() const {
std::vector<GnsNode> nodes;
std::vector<std::shared_ptr<GnsNode>> GnsProject::getNodes() const {
std::vector<std::shared_ptr<GnsNode>> nodes;
// request the API endpoint
cpr::Url endpoint = this->getApiBase() + "nodes";
@ -59,11 +59,11 @@ std::vector<GnsNode> GnsProject::getNodes() const {
}
// save the node
nodes.emplace_back(
nodes.emplace_back(std::make_shared<GnsNode>(
this,
node_data["node_id"],
ports
);
));
}
return nodes;