[{"id":35548,"web_url":"https://patchwork.libcamera.org/comment/35548/","msgid":"<175598424696.2293573.9550376511007610344@ping.linuxembedded.co.uk>","date":"2025-08-23T21:24:06","subject":"Re: [PATCH v1] apps: qcam: Do nothing if no camera is selected","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Barnabás Pőcze (2025-08-22 16:08:54)\n> If the currently selected camera disappears as reported by the `cameraRemoved`\n> signal, then `MainWindow::camera_` is reset to `nullptr`. In this case,\n> pressing the start/stop button will try to start streaming, leading to\n> a nullptr derefence in `MainWindow::startCapture()` when the configuration\n> is generated for the camera.\n> \n> Fix that by returning from `MainWindow::toggleCapture()` if no camera is set.\n> While this will cause the \"checked\" status of `startStopAction_` to go out of\n> sync, this should not be an issue because when a new camera is selected, the\n> state is synchronized.\n> \n> Bug: https://bugs.libcamera.org/show_bug.cgi?id=177\n> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n> ---\n>  src/apps/qcam/main_window.cpp | 3 +++\n>  1 file changed, 3 insertions(+)\n> \n> diff --git a/src/apps/qcam/main_window.cpp b/src/apps/qcam/main_window.cpp\n> index 7e3f3da60..96a2d5090 100644\n> --- a/src/apps/qcam/main_window.cpp\n> +++ b/src/apps/qcam/main_window.cpp\n> @@ -333,6 +333,9 @@ int MainWindow::openCamera()\n>  \n>  void MainWindow::toggleCapture(bool start)\n>  {\n> +       if (!camera_)\n\nI wondered if we should update the user with a status bar message or\nsuch - but we don't have one ... so there's not much we can do...\n\nI expect the Icon stays at the play symbol ... which should be fine.\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> +               return;\n> +\n>         if (start) {\n>                 startCapture();\n>                 startStopAction_->setIcon(iconStop_);\n> -- \n> 2.50.1\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 7FC5DBD87C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat, 23 Aug 2025 21:24:14 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 51560692E2;\n\tSat, 23 Aug 2025 23:24:12 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8D1A0613C1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 23 Aug 2025 23:24:10 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 381FA484A;\n\tSat, 23 Aug 2025 23:23:09 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"XOxllbae\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1755984189;\n\tbh=OxEJ50YqEjl/TaAf0eU/zuXGC6WKTZqIZ4EDHTsV09A=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=XOxllbae2Kua8YOTVItkKUc+h1xBLm/uTTx16uA0th1oO60Hc02OxgnMJSRGBs+OT\n\tRwOq256VOX+oNqnK4vrKmpav5mI8Cu0TFz9NOV/P6SbxLxS5nzeieYjB7J2/8AXgHc\n\tLrMNVDq1rUh1HPX420LP7yGZ1Lv6LEl/A4LZx/RY=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20250822150854.591964-1-barnabas.pocze@ideasonboard.com>","References":"<20250822150854.591964-1-barnabas.pocze@ideasonboard.com>","Subject":"Re: [PATCH v1] apps: qcam: Do nothing if no camera is selected","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Sat, 23 Aug 2025 22:24:06 +0100","Message-ID":"<175598424696.2293573.9550376511007610344@ping.linuxembedded.co.uk>","User-Agent":"alot/0.9.1","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]