[libcamera-devel] [PATCH] qcam: Fix camera reference leak on hot-unplug
Umang Jain
email at uajain.com
Mon Jul 27 14:32:59 CEST 2020
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>
---
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);
}
--
2.26.2
More information about the libcamera-devel
mailing list