diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2020-01-22 21:25:05 +0200 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2020-01-23 22:36:30 +0200 |
commit | a0295fdaf854bb10c387255f10677d9b6f1554dc (patch) | |
tree | 85c82ea804c0f373566924435b3c165f7399ea69 | |
parent | b6467bd9c67f69fe5023cb524391b8f1fc5c44c4 (diff) |
libcamera: camera_manager: Return a copy of the vector from cameras()
Making CameraManager::cameras() thread-safe requires returning a copy of
the cameras vector instead of a reference. This is also required for
hot-plugging support and is thus desirable.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
-rw-r--r-- | include/libcamera/camera_manager.h | 2 | ||||
-rw-r--r-- | src/libcamera/camera_manager.cpp | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/include/libcamera/camera_manager.h b/include/libcamera/camera_manager.h index 068afd58..079f848a 100644 --- a/include/libcamera/camera_manager.h +++ b/include/libcamera/camera_manager.h @@ -30,7 +30,7 @@ public: int start(); void stop(); - const std::vector<std::shared_ptr<Camera>> &cameras() const; + std::vector<std::shared_ptr<Camera>> cameras() const; std::shared_ptr<Camera> get(const std::string &name); std::shared_ptr<Camera> get(dev_t devnum); diff --git a/src/libcamera/camera_manager.cpp b/src/libcamera/camera_manager.cpp index e0a07ec5..5fc1bba9 100644 --- a/src/libcamera/camera_manager.cpp +++ b/src/libcamera/camera_manager.cpp @@ -244,7 +244,7 @@ void CameraManager::stop() * * \return List of all available cameras */ -const std::vector<std::shared_ptr<Camera>> &CameraManager::cameras() const +std::vector<std::shared_ptr<Camera>> CameraManager::cameras() const { return p_->cameras_; } |