[PATCH v2] qcam: Automatically select the camera if only one is available

Stanislaw Gruszka stanislaw.gruszka at linux.intel.com
Tue Oct 22 12:04:09 CEST 2024


On Mon, Oct 21, 2024 at 05:25:09PM +0200, Stanislaw Gruszka wrote:
> But it crashes here if there are no cameras and user press OK
> button in dialog window, due to lack of !camera_ check.
> I can fix that and post as v3...
<snip>

> > The change to MainWindow::chooseCamera() is not strictly mandatory, but
> > results (I think) in cleaner code in MainWindow::openCamera(). Feel free
> > to propose alternatives, the important part to avoid TOCTOU races and
> > keep MainWindow::openCamera() clean is
> > 
> > 		std::vector<std::shared_ptr<Camera>> cameras = cm_->cameras();

After second thought I rather opted to fixup my small patch using above vector
copy and add your's comment change since is nicer :-)

The change of MainWindow::chooseCamera() make sense to me, but can be done
separately as cleanup.

Regards
Stanislaw


More information about the libcamera-devel mailing list