fix(ocr): resolve silent OCR language not updating promptly#1047
Merged
fix(ocr): resolve silent OCR language not updating promptly#1047
Conversation
This commit fixes an issue where the OCR language setting was not being updated immediately during background OCR operations. The root cause was that background OCR was reusing the existing query model without updating the language settings from the current configuration. This led to OCR using stale language preferences. The fix adds a new method `resetQueryModelForBackgroundOCR` that creates a fresh query model with the current language settings from Configuration.shared and properly rebinds all dependent managers and services. This ensures that OCR operations always use the most recent language preferences.
Jerry23011
reviewed
Jan 3, 2026
Easydict/objc/ViewController/Window/BaseQueryWindow/EZBaseQueryViewController.m
Outdated
Show resolved
Hide resolved
This commit fixes a compilation error in EZBaseQueryViewController where the Configuration class was referenced incorrectly. The error occurred because the code was using `Configuration.shared` instead of the correct `MyConfiguration.shared` class name that was introduced during the migration from Configuration to MyConfiguration. This fix ensures the Objective-C code can properly access the configuration singleton without compilation errors.
phlpsong
previously approved these changes
Jan 4, 2026
Collaborator
|
I can reproduce the issue in #1040 in the latest release version, it's now fixed with this PR. But when I try 截图翻译, the app crashes. The crash doesn't happen with the release version or building on The crash also happens on Crash log On Xcode:
|
Owner
Author
|
ok, i see, i will fix it later. |
This commit fixes a critical UI crash issue in OCR processing by ensuring all callbacks are dispatched to the main thread.
The issue occurred when OCR completion handlers were called on background threads, causing UI updates to fail with threading violations. The fix wraps the completion callback in a `dispatch_async(dispatch_get_main_queue(), ^{ ... })` block to ensure all UI-related updates happen on the main thread.
This prevents crashes that occurred when updating UI elements in response to OCR results.
Owner
Author
|
Since I had rewritten all the ocr api with swift async/awiat, objc calls to ocr would automatically call back to a non-main thread, and this would cause the update UI to crash. I fixed this crash by manually calling back objc's ocr function to the main thread, fixed in 3a94d8f |
Owner
Author
|
@Jerry23011 please check it again |
Jerry23011
approved these changes
Jan 4, 2026
Collaborator
Jerry23011
left a comment
There was a problem hiding this comment.
Both issues fixed. LGTM.
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.

This commit fixes an issue where the OCR language setting was not being updated immediately during background OCR operations.
The root cause was that background OCR was reusing the existing query model without updating the language settings from the current configuration. This led to OCR using stale language preferences.
The fix adds a new method
resetQueryModelForBackgroundOCRthat creates a fresh query model with the current language settings from Configuration.shared and properly rebinds all dependent managers and services. This ensures that OCR operations always use the most recent language preferences.Fix #1040