libcamera: v4l2_subdevice: Close subdevice when destroyed
Make sure the subdevice file descriptor isn't leaked by closing it when the V4L2Subdevice instance is destroyed. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
parent
889b70d62d
commit
d97cafdf3c
2 changed files with 6 additions and 0 deletions
|
@ -35,6 +35,7 @@ public:
|
||||||
explicit V4L2Subdevice(const MediaEntity *entity);
|
explicit V4L2Subdevice(const MediaEntity *entity);
|
||||||
V4L2Subdevice(const V4L2Subdevice &) = delete;
|
V4L2Subdevice(const V4L2Subdevice &) = delete;
|
||||||
V4L2Subdevice &operator=(const V4L2Subdevice &) = delete;
|
V4L2Subdevice &operator=(const V4L2Subdevice &) = delete;
|
||||||
|
~V4L2Subdevice();
|
||||||
|
|
||||||
int open();
|
int open();
|
||||||
bool isOpen() const;
|
bool isOpen() const;
|
||||||
|
|
|
@ -112,6 +112,11 @@ V4L2Subdevice::V4L2Subdevice(const MediaEntity *entity)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
V4L2Subdevice::~V4L2Subdevice()
|
||||||
|
{
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Open a V4L2 subdevice
|
* \brief Open a V4L2 subdevice
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue