From c8edfe29c185dade3aa584363d91643755fe7e02 Mon Sep 17 00:00:00 2001 From: Umang Jain Date: Mon, 27 Jul 2020 12:32:59 +0000 Subject: qcam: Fix camera reference leak on hot-unplug 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 Reviewed-by: Laurent Pinchart Signed-off-by: Laurent Pinchart --- src/qcam/main_window.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/qcam') diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp index 17767420..13a4fefe 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); } -- cgit v1.2.1