diff options
Diffstat (limited to 'src/libcamera/base/class.cpp')
-rw-r--r-- | src/libcamera/base/class.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/libcamera/base/class.cpp b/src/libcamera/base/class.cpp index d24043c2..9c2d9f21 100644 --- a/src/libcamera/base/class.cpp +++ b/src/libcamera/base/class.cpp @@ -147,9 +147,12 @@ namespace libcamera { /** * \brief Construct an instance of an Extensible class * \param[in] d Pointer to the private data instance + * + * The private data lifetime is managed by the Extensible class, which destroys + * it when the Extensible instance is destroyed. */ -Extensible::Extensible(Extensible::Private *d) - : d_(d) +Extensible::Extensible(std::unique_ptr<Extensible::Private> d) + : d_(std::move(d)) { *const_cast<Extensible **>(&d_->o_) = this; } @@ -163,6 +166,10 @@ Extensible::Extensible(Extensible::Private *d) * overriden _d() functions that return the correct pointer type to the * corresponding derived Private class. * + * The lifetime of the private data is tied to the Extensible class. The caller + * shall not retain any reference to the returned pointer for longer than it + * holds a reference to the Extensible instance. + * * \return A pointer to the private data instance */ |