Run AsyncResource completions on EDT in InternalCallback#14
Open
shai-almog wants to merge 1 commit intomasterfrom
Open
Run AsyncResource completions on EDT in InternalCallback#14shai-almog wants to merge 1 commit intomasterfrom
shai-almog wants to merge 1 commit intomasterfrom
Conversation
Contributor
Author
|
@shannah can you please review? |
There was a problem hiding this comment.
Pull request overview
This PR updates InternalCallback in the fingerprint module to ensure AsyncResource terminal handlers (complete/error/cancel) execute on Codename One’s EDT, reducing UI-threading hazards in native callback paths.
Changes:
- Wrap
req.complete(...),req.error(...), andreq.cancel(...)inDisplay.getInstance().callSerially(...)so terminal events run on the EDT. - Add an inner
!req.isDone()guard inside the EDT runnable to prevent duplicate terminal actions when multiple callbacks race.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
common/src/main/java/com/codename1/fingerprint/impl/InternalCallback.java
Show resolved
Hide resolved
common/src/main/java/com/codename1/fingerprint/impl/InternalCallback.java
Show resolved
Hide resolved
common/src/main/java/com/codename1/fingerprint/impl/InternalCallback.java
Show resolved
Hide resolved
common/src/main/java/com/codename1/fingerprint/impl/InternalCallback.java
Show resolved
Hide resolved
b26f66c to
e814443
Compare
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.
Motivation
AsyncResourcecompletion, error and cancel handlers are executed on the UI thread to avoid threading issues.isDone.Description
req.complete,req.error, andreq.cancelcalls inDisplay.getInstance().callSerially(...)inInternalCallbackso they run on the EDT.!req.isDone()guard and add an inner!req.isDone()check inside the runnable to avoid duplicate terminal actions.requestSuccess,requestError,requestKeyRevokedError, andrequestCompletemethods.Testing
Codex Task