apps: qcam: Push the viewfinder role to vector
diff mbox series

Message ID 20250507210648.83184-1-kieran.bingham@ideasonboard.com
State Accepted
Commit a79941501716eb65e6d905d2430bddf48887f3f5
Headers show
Series
  • apps: qcam: Push the viewfinder role to vector
Related show

Commit Message

Kieran Bingham May 7, 2025, 9:06 p.m. UTC
In commit ee2b011b65c6 ("apps: cam: Try raw role if default viewfinder
role fails"), the viewfinder role is specified as the default if no role
is yet chosen.

This was unfortunately added by directly accessing the vector rather
than extending the size when the vector is empty. Fix the code to push
the default viewfinder role on to the back of the vector, increasing the
size appropriately.

Fixes: ee2b011b65c6 ("apps: cam: Try raw role if default viewfinder role fails")
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
 src/apps/qcam/main_window.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Barnabás Pőcze May 8, 2025, 7:43 a.m. UTC | #1
2025. 05. 07. 23:06 keltezéssel, Kieran Bingham írta:
> In commit ee2b011b65c6 ("apps: cam: Try raw role if default viewfinder
> role fails"), the viewfinder role is specified as the default if no role
> is yet chosen.
> 
> This was unfortunately added by directly accessing the vector rather
> than extending the size when the vector is empty. Fix the code to push
> the default viewfinder role on to the back of the vector, increasing the
> size appropriately.
> 
> Fixes: ee2b011b65c6 ("apps: cam: Try raw role if default viewfinder role fails")
> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Tested-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>


> ---
>   src/apps/qcam/main_window.cpp | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/apps/qcam/main_window.cpp b/src/apps/qcam/main_window.cpp
> index 224a7e5a693a..7e3f3da605c4 100644
> --- a/src/apps/qcam/main_window.cpp
> +++ b/src/apps/qcam/main_window.cpp
> @@ -357,7 +357,7 @@ int MainWindow::startCapture()
>   	/* Verify roles are supported. */
>   	switch (roles.size()) {
>   	case 0:
> -		roles[0] = StreamRole::Viewfinder;
> +		roles.push_back(StreamRole::Viewfinder);
>   		break;
>   	case 1:
>   		if (roles[0] != StreamRole::Viewfinder) {
Paul Elder May 8, 2025, 8:02 a.m. UTC | #2
On Wed, May 07, 2025 at 11:06:48PM +0200, Kieran Bingham wrote:
> In commit ee2b011b65c6 ("apps: cam: Try raw role if default viewfinder
> role fails"), the viewfinder role is specified as the default if no role
> is yet chosen.
> 
> This was unfortunately added by directly accessing the vector rather
> than extending the size when the vector is empty. Fix the code to push
> the default viewfinder role on to the back of the vector, increasing the
> size appropriately.
> 
> Fixes: ee2b011b65c6 ("apps: cam: Try raw role if default viewfinder role fails")
> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>

> ---
>  src/apps/qcam/main_window.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/apps/qcam/main_window.cpp b/src/apps/qcam/main_window.cpp
> index 224a7e5a693a..7e3f3da605c4 100644
> --- a/src/apps/qcam/main_window.cpp
> +++ b/src/apps/qcam/main_window.cpp
> @@ -357,7 +357,7 @@ int MainWindow::startCapture()
>  	/* Verify roles are supported. */
>  	switch (roles.size()) {
>  	case 0:
> -		roles[0] = StreamRole::Viewfinder;
> +		roles.push_back(StreamRole::Viewfinder);
>  		break;
>  	case 1:
>  		if (roles[0] != StreamRole::Viewfinder) {
> -- 
> 2.49.0
>

Patch
diff mbox series

diff --git a/src/apps/qcam/main_window.cpp b/src/apps/qcam/main_window.cpp
index 224a7e5a693a..7e3f3da605c4 100644
--- a/src/apps/qcam/main_window.cpp
+++ b/src/apps/qcam/main_window.cpp
@@ -357,7 +357,7 @@  int MainWindow::startCapture()
 	/* Verify roles are supported. */
 	switch (roles.size()) {
 	case 0:
-		roles[0] = StreamRole::Viewfinder;
+		roles.push_back(StreamRole::Viewfinder);
 		break;
 	case 1:
 		if (roles[0] != StreamRole::Viewfinder) {