summaryrefslogtreecommitdiff
path: root/src/qcam/main_window.cpp
diff options
context:
space:
mode:
authorUmang Jain <email@uajain.com>2020-07-27 12:32:59 +0000
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-07-27 22:30:07 +0300
commitc8edfe29c185dade3aa584363d91643755fe7e02 (patch)
treeee097342f3c63a6bd58ede8993d70bac6ffc69b0 /src/qcam/main_window.cpp
parente349cb0f8a89057b08c7f080d89011b42d3f88e6 (diff)
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 <email@uajain.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/qcam/main_window.cpp')
-rw-r--r--src/qcam/main_window.cpp2
1 files changed, 2 insertions, 0 deletions
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);
}