[libcamera-devel] [PATCH] qcam: Fix camera reference leak on hot-unplug
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Mon Jul 27 17:05:33 CEST 2020
Hi Umang,
Thank you for the patch.
On Mon, Jul 27, 2020 at 12:32:59PM +0000, Umang Jain wrote:
> If the currently streaming camera is hot-unplugged,
> a camera reference was still held by MainWindow::camera_,
> preventing it to be destructed, until qcam window is
> closed. Plug the leak in the hot-unplug handler itself.
>
> Signed-off-by: Umang Jain <email at uajain.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
Does this fix all the shared pointer refcount issues you've been chasing
?
> ---
> src/qcam/main_window.cpp | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp
> index 7bc1360..c8298ec 100644
> --- a/src/qcam/main_window.cpp
> +++ b/src/qcam/main_window.cpp
> @@ -587,6 +587,8 @@ void MainWindow::processHotplug(HotplugEvent *e)
> /* Check if the currently-streaming camera is removed. */
> if (camera == camera_.get()) {
> toggleCapture(false);
> + camera_->release();
> + camera_.reset();
> cameraCombo_->setCurrentIndex(0);
> }
>
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list