libcamera: camera_manager: Turn enumerator into a unique_ptr<>
Convey the fact that the CameraManager class owns the DeviceEnumerator instance it creates by using std::unique_ptr<> to store the pointer. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
This commit is contained in:
@@ -73,7 +73,6 @@ CameraManager::~CameraManager()
|
||||
*/
|
||||
int CameraManager::start()
|
||||
{
|
||||
|
||||
if (enumerator_)
|
||||
return -ENODEV;
|
||||
|
||||
@@ -95,7 +94,7 @@ int CameraManager::start()
|
||||
*/
|
||||
while (1) {
|
||||
PipelineHandler *pipe = factory->create();
|
||||
if (!pipe->match(enumerator_)) {
|
||||
if (!pipe->match(enumerator_.get())) {
|
||||
delete pipe;
|
||||
break;
|
||||
}
|
||||
@@ -130,10 +129,7 @@ void CameraManager::stop()
|
||||
|
||||
pipes_.clear();
|
||||
|
||||
if (enumerator_)
|
||||
delete enumerator_;
|
||||
|
||||
enumerator_ = nullptr;
|
||||
enumerator_.reset(nullptr);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user