From 2d50b1664508e86e4d27b8620e74f8e82dfe1d57 Mon Sep 17 00:00:00 2001 From: Paul Elder Date: Thu, 12 Nov 2020 13:58:29 +0900 Subject: qcam: Clear the pool of free requests upon stopCapture() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To enable reusing Request objects, we kept a pool of free Requests. This pool was not cleared upon stopping capture, however, which caused a segfault when switching to another camera. Fix this by clearing the Request pool on stopCapture(). Fixes: c753223ad6b9 ("libcamera, android, cam, gstreamer, qcam, v4l2: Reuse Request") Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart Reviewed-by: Niklas Söderlund Reviewed-by: Kieran Bingham Tested-by: Kieran Bingham Tested-by: Jean-Michel Hautbois --- src/qcam/main_window.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/qcam') diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp index f140313e..2502ecd4 100644 --- a/src/qcam/main_window.cpp +++ b/src/qcam/main_window.cpp @@ -579,6 +579,7 @@ void MainWindow::stopCapture() mappedBuffers_.clear(); requests_.clear(); + freeQueue_.clear(); delete allocator_; -- cgit v1.2.1