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>
This commit is contained in:
committed by
Laurent Pinchart
parent
e349cb0f8a
commit
c8edfe29c1
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user