{"id":24182,"url":"https://patchwork.libcamera.org/api/patches/24182/?format=json","web_url":"https://patchwork.libcamera.org/patch/24182/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20250822150854.591964-1-barnabas.pocze@ideasonboard.com>","date":"2025-08-22T15:08:54","name":"[v1] apps: qcam: Do nothing if no camera is selected","commit_ref":"16cbc826b7915079dc78862041c4f12a7d6ea7c2","pull_url":null,"state":"accepted","archived":false,"hash":"b6db7c85b127dc3125068689645011f06946f940","submitter":{"id":216,"url":"https://patchwork.libcamera.org/api/people/216/?format=json","name":"Barnabás Pőcze","email":"barnabas.pocze@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/24182/mbox/","series":[{"id":5399,"url":"https://patchwork.libcamera.org/api/series/5399/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5399","date":"2025-08-22T15:08:54","name":"[v1] apps: qcam: Do nothing if no camera is selected","version":1,"mbox":"https://patchwork.libcamera.org/series/5399/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/24182/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/24182/checks/","tags":{},"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 6C6C3BEFBE\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 22 Aug 2025 15:09:02 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 75E3B692DF;\n\tFri, 22 Aug 2025 17:09:00 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0211D613C3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 22 Aug 2025 17:08:57 +0200 (CEST)","from pb-laptop.local (185.221.141.188.nat.pool.zt.hu\n\t[185.221.141.188])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id A817A11D5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 22 Aug 2025 17:07:57 +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=\"nzSjOnw0\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1755875277;\n\tbh=Oyxox+wZFBvI/+EI/1GGruauB+9HQh03q/Utl/U9694=;\n\th=From:To:Subject:Date:From;\n\tb=nzSjOnw0O+xzh7+cx4rJudVeiYkzJroH7dN38cLI3KBo9Wkj1Ke4zZD7dr6ZyHQmf\n\tRyz3j5c+aHH7B2VlLbXvbBoRQEFnePAEO9zZmfCfwCcqA59zVD8OYrLzmB+MmQJJL0\n\t+CuiboI/Ju7io0Jp0/tfuWzBCeLAZm448hFkg4Yw=","From":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Subject":"[PATCH v1] apps: qcam: Do nothing if no camera is selected","Date":"Fri, 22 Aug 2025 17:08:54 +0200","Message-ID":"<20250822150854.591964-1-barnabas.pocze@ideasonboard.com>","X-Mailer":"git-send-email 2.50.1","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","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>"},"content":"If the currently selected camera disappears as reported by the `cameraRemoved`\nsignal, then `MainWindow::camera_` is reset to `nullptr`. In this case,\npressing the start/stop button will try to start streaming, leading to\na nullptr derefence in `MainWindow::startCapture()` when the configuration\nis generated for the camera.\n\nFix that by returning from `MainWindow::toggleCapture()` if no camera is set.\nWhile this will cause the \"checked\" status of `startStopAction_` to go out of\nsync, this should not be an issue because when a new camera is selected, the\nstate is synchronized.\n\nBug: https://bugs.libcamera.org/show_bug.cgi?id=177\nSigned-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(+)","diff":"diff --git a/src/apps/qcam/main_window.cpp b/src/apps/qcam/main_window.cpp\nindex 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+\tif (!camera_)\n+\t\treturn;\n+\n \tif (start) {\n \t\tstartCapture();\n \t\tstartStopAction_->setIcon(iconStop_);\n","prefixes":["v1"]}