use smart pointer when creating an object with an instance of the creator

This commit is contained in:
faraphel 2024-12-23 13:12:46 +01:00
parent a0060c8fa8
commit f1ee437f04
6 changed files with 12 additions and 10 deletions

View file

@ -15,9 +15,9 @@ class GnsServer;
/**
* Represent a GNS3 project.
*/
class GnsProject {
class GnsProject : std::enable_shared_from_this<GnsProject> {
public:
GnsProject(const GnsServer* server, const std::string& uuid);
GnsProject(const std::shared_ptr<const GnsServer>& server, const std::string& uuid);
/**
* Get the base prefix for an API request
@ -38,7 +38,7 @@ public:
[[nodiscard]] std::vector<std::shared_ptr<GnsNode>> getNodes() const;
private:
const GnsServer* server;
std::shared_ptr<const GnsServer> server;
std::string uuid;
};