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

HTML images trigger ThreadCheckingRepaintManager thread violation #39

Open
BullyWiiPlaza opened this issue May 13, 2019 · 1 comment
Open

Comments

@BullyWiiPlaza
Copy link

BullyWiiPlaza commented May 13, 2019

I use code to detect EDT thread violations (e.g. a non-EDT thread modifies the Swing GUI):

private static void setupThreadViolationsDetector()
{
	ThreadCheckingRepaintManager repaintManager = new ThreadCheckingRepaintManager(true);
	RepaintManager.setCurrentManager(repaintManager);
}

However, when I load an HTML code snippet which contains loading an image into the GUI, the following wrong thread exception is being printed, even though JTextPane.setText(myHTML) is called on the EDT.

----------Wrong Thread START
java.lang.Exception
	at com.jidesoft.utils.ThreadCheckingRepaintManager.checkThreadViolations(ThreadCheckingRepaintManager.java:78)
	at com.jidesoft.utils.ThreadCheckingRepaintManager.addDirtyRegion(ThreadCheckingRepaintManager.java:72)
	at java.desktop/javax.swing.JComponent.repaint(JComponent.java:4836)
	at java.desktop/javax.swing.text.html.ImageView.repaint(ImageView.java:655)
	at java.desktop/javax.swing.text.html.ImageView$ImageHandler.imageUpdate(ImageView.java:990)
	at java.desktop/sun.awt.image.ImageWatched$WeakLink.lambda$update$0(ImageWatched.java:144)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.desktop/sun.awt.image.ImageWatched$WeakLink.update(ImageWatched.java:142)
	at java.desktop/sun.awt.image.ImageWatched$WeakLink.newInfo(ImageWatched.java:159)
	at java.desktop/sun.awt.image.ImageWatched.newInfo(ImageWatched.java:197)
	at java.desktop/sun.awt.image.ImageRepresentation.imageComplete(ImageRepresentation.java:724)
	at java.desktop/sun.awt.image.ImageDecoder.imageComplete(ImageDecoder.java:153)
	at java.desktop/sun.awt.image.JPEGImageDecoder.produceImage(JPEGImageDecoder.java:143)
	at java.desktop/sun.awt.image.InputStreamImageSource.doFetch(InputStreamImageSource.java:269)
	at java.desktop/sun.awt.image.ImageFetcher.fetchloop(ImageFetcher.java:212)
	at java.desktop/sun.awt.image.ImageFetcher.run(ImageFetcher.java:176)

----------Wrong Thread END

Is this a bug you could fix?

I'm using jdk-11.0.1 on Windows 10.

@jidesoft
Copy link
Owner

jidesoft commented May 13, 2019

This piece of code was actually created by Scott Delap and Alex Potochkin. It is public domain. We included it for our user's convenience. We don't intent to take the maintenance responsibility. Feel free to modify it and send in a merge request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants