Repository navigation
Conversation
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.
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.