[PATCH v2] qcam: Automatically select the camera if only one is available
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Wed Oct 23 00:15:19 CEST 2024
On Tue, Oct 22, 2024 at 12:04:09PM +0200, Stanislaw Gruszka wrote:
> 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 :-)
My proposal was very much meant to generate first *and* second thoughts,
so I'm happy it was useful for something :-)
> The change of MainWindow::chooseCamera() make sense to me, but can be done
> separately as cleanup.
Fine with me.
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list