Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CheckThreadViolationRepaintManager gives false positives when used with SwingWorker #223

Closed
lbalazscs opened this Issue Oct 5, 2018 · 3 comments

Comments

Projects
None yet
2 participants
@lbalazscs
Copy link
Contributor

lbalazscs commented Oct 5, 2018

org.assertj.swing.edt.CheckThreadViolationRepaintManager works by inspecting the stack trace of repaint calls which are not on the EDT, and if it sees a swing package before the repaint call, it assumes that Swing called it. repaint() in itself can be called from any thread, but the assumption is that if a swing code calls repaint() outside the EDT, something else in Swing was manipulated outside the EDT.

Calling repaint() on the background thread of a SwingWorker is OK (as repaint() in itself is thread-safe) , but the problem is that this leaves a "javax.swing" in the stack trace, and confuses CheckThreadViolationRepaintManager . Note that newer versions of the "swinghelper" (from where this code is coming), do take SwingWorker into account, see for example https://github.com/floscher/swinghelper/blob/master/src/java/org/jdesktop/swinghelper/debug/CheckThreadViolationRepaintManager.java

debugger

@croesch

This comment has been minimized.

Copy link
Collaborator

croesch commented Nov 19, 2018

Hi @lbalazscs

Thanks for submitting this issue! You sound like you took a good effort in analyzing this issue, could you also come up with a pull request that solves that issue? Looking forward reviewing and merging it! :)

best regards,
Christian

@lbalazscs

This comment has been minimized.

Copy link
Contributor Author

lbalazscs commented Nov 19, 2018

OK, I will send a pull request in a few days.

lbalazscs added a commit to lbalazscs/assertj-swing that referenced this issue Nov 21, 2018

lbalazscs added a commit to lbalazscs/assertj-swing that referenced this issue Nov 21, 2018

croesch added a commit that referenced this issue Nov 26, 2018

@croesch

This comment has been minimized.

Copy link
Collaborator

croesch commented Feb 8, 2019

Released in 3.9.2. Thanks for your help!

@croesch croesch closed this Feb 8, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.