<div id="geary-body" dir="auto"><div>Hi,</div></div><div id="geary-quote" dir="auto"><br>On Mon, Apr 27, 2020 at 01:31, Laurent Pinchart <laurent.pinchart@ideasonboard.com> wrote:<br><blockquote type="cite"><div class="plaintext" style="white-space: pre-wrap;">If the camera specified on the command line can't be opened, the
MainWindow constructor still proceeds to check the startStopAction_,
which results in MainWindow::startCapture() being called and trying to
use a null camera_ object. Fix this by returning from the constructor as
soon as the error is detected.

Signed-off-by: Laurent Pinchart <<a href="mailto:laurent.pinchart@ideasonboard.com">laurent.pinchart@ideasonboard.com</a>>
---
 src/qcam/main_window.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp
index cf39ed7aceca..ed0cad417d62 100644
--- a/src/qcam/main_window.cpp
+++ b/src/qcam/main_window.cpp
@@ -70,8 +70,10 @@ MainWindow::MainWindow(CameraManager *cm, const OptionsParser::Options &options)
 
        /* Open the camera and start capture. */
        ret = openCamera();
-       if (ret < 0)
+       if (ret < 0) {
                quit();
+               return;
+       }
 
        startStopAction_->setChecked(true);
 }</div></blockquote><span style="white-space: pre-wrap;"><div><span style="white-space: pre-wrap;"><br></span></div><div><span style="white-space: pre-wrap;"><br></span></div></span>This also fixes a segfault when the "Select Camera" dialog is closed[x] to exit QCam (i.e. no camera is selected).<div>Thanks.</div><div><br></div><div>Reviewed-by: Umang Jain <email@uajain.com></div><div><br></div><blockquote type="cite"><div class="plaintext" style="white-space: pre-wrap;"><div>-- 
</div>Regards,

Laurent Pinchart

_______________________________________________
libcamera-devel mailing list
<a href="mailto:libcamera-devel@lists.libcamera.org">libcamera-devel@lists.libcamera.org</a>
<a href="https://u15657259.ct.sendgrid.net/ls/click?upn=8H1KCc2bev8KdIveckpOEBeWjI3THEr-2F8W-2FrEpvXj1fUaD8nZSgfyCwFn-2BKX4QPmzP3yuD-2FqUTQ0p4eTt76rvA-3D-3DJPas_C3wFy2Q4UgRsRLDAYieRZ5Z3EhAWyy0-2FkOzyYc6FPc1dn6ROcAJqKXb9hjP566uP1e5M4N-2F8GT19qzOCb8CuCbjRmaTt2bhpAKje2FT64kO4pDIs7BS1scJE9Etu6MU-2FxgDWSRBBOqpOcyGDKiqQw61GmwCUnva7cdmHPQdt52Rx6-2FX4nM5ah0PKnXOXTJ43Igj1atDBqRdHSvaXiZUgTFfpvHUSp8yVY0D2QmENiYQnXOtE42Gq-2F-2FF7my4GCxE19qAcdBl1kwWSVPhKqboIvQ-3D-3D">https://lists.libcamera.org/listinfo/libcamera-devel</a>
</div></blockquote></div><img src="https://u15657259.ct.sendgrid.net/wf/open?upn=GCEip0g28ftA9O9fsCR2M7x08El53O4YVYtHuSI-2FrLwtytoSlmO-2FnSq-2B0q807R-2FEiyxVFMk-2B4TH6-2Bq6eI3ZK1u9-2FFdjg8DdohYoY9i5oMTKAooPpij9j-2FIgwR-2BIQrgAUR-2B9BPxogBzlaczJI-2BXXS1TyM8Srq761OAayUlUzFeF60ECi-2BurbNCMyD-2B6GgHYhcOi-2BypWIcUHeBvPidr-2Bbk-2FgRXg-2BfOlCwVaCezLumn2LDeLQaJ37I-2FE6HxBapf1XJeksgLN6QqBH7Yl9HaYpWB-2FQ-3D-3D" alt="" width="1" height="1" border="0" style="height:1px !important;width:1px !important;border-width:0 !important;margin-top:0 !important;margin-bottom:0 !important;margin-right:0 !important;margin-left:0 !important;padding-top:0 !important;padding-bottom:0 !important;padding-right:0 !important;padding-left:0 !important;"/>