Repository navigation
fix(desktop qr): show an error on Linux when the camera can't be opened - #1488
Merged
julian-CStack merged 1 commit intoNov 3, 2026
Merged
Conversation
sneurlax
force-pushed
the
fix/linux-qr-camera-timeout
branch
from
November 2, 2026 21:01
987df2c to
738f304
Compare
julian-CStack
force-pushed
the
fix/linux-qr-camera-timeout
branch
from
November 2, 2026 21:13
738f304 to
b3f5e9f
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## fix/qr-image-file-decoding #1488 +/- ##
==============================================================
- Coverage 11.66% 11.66% -0.01%
==============================================================
Files 1136 1136
Lines 114344 114368 +24
==============================================================
Hits 13341 13341
- Misses 101003 101027 +24 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
camera_linux's initializeCamera() only starts a capture thread, so with no camera it succeeds and captureImage() returns empty frames forever, leaving the dialog spinning. Wait up to 10 s for a first frame and report the camera as unavailable otherwise. Create the plugin inside the guarded init, since its constructor throws if libcamera_linux.so can't be loaded. On every platform, show an error once no usable frame has arrived for 10 s instead of only after 20 capture exceptions.
sneurlax
force-pushed
the
fix/linux-qr-camera-timeout
branch
from
November 3, 2026 19:59
fa844f4 to
9c21af9
Compare
julian-CStack
approved these changes
Nov 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Base:
fix/qr-image-file-decoding. Third of three stacked PRs on top of the Windows QR camera fix.On Linux, opening the QR dialog with no working camera shows a spinner forever instead of an error.
Cause
camera_linux'sinitializeCamera()only starts a capture thread and never fails. If OpenCV can't open a camera, the thread exits, andcaptureImage()keeps returning empty frames (or throws on a null frame pointer) indefinitely. The dialog treated a successfulinitializeCamera()as an open camera and kept polling. Also, the plugin was constructed in a field initializer, and its constructor dlopenslibcamera_linux.so, so a missing or broken library threw outside the dialog's error handling.Change
All in
lib/widgets/desktop/qr_code_scanner_dialog.dart:_initializeCamera's try, so a library load failure becomes the dialog's normal "unable to open the camera" error.initializeCamera(), the dialog waits up to 10 seconds for a first non-empty frame. If none arrives, it stops the plugin and shows that error, with the usual pointer to "Select file".TimeoutExceptiongets a readable message in the init error.This only changes when the error appears. Capture and decoding are unchanged.