Skip to content
Permalink
Browse files
8252596: [TESTBUG] WebPageShim::paint is not thread-safe
Reviewed-by: kcr
  • Loading branch information
arun-Joseph committed Oct 22, 2020
1 parent a5a71d1 commit 4e5f0e6b4a54bff68ae10701078741ef18ebe6d5
Showing with 4 additions and 1 deletion.
  1. +4 −1 modules/javafx.web/src/shims/java/com/sun/webkit/WebPageShim.java
@@ -26,6 +26,7 @@
package com.sun.webkit;

import com.sun.javafx.webkit.prism.WCBufferedContextShim;
import com.sun.javafx.webkit.prism.PrismInvokerShim;
import com.sun.webkit.WebPage;
import com.sun.webkit.event.WCMouseEvent;
import com.sun.webkit.graphics.WCGraphicsContext;
@@ -50,7 +51,9 @@ private static WCGraphicsContext setupPageWithGraphics(WebPage page, int x, int

public static BufferedImage paint(WebPage page, int x, int y, int w, int h) {
final WCGraphicsContext gc = setupPageWithGraphics(page, x, y, w, h);
page.paint(gc, x, y, w, h);
PrismInvokerShim.runOnRenderThread(() -> {
page.paint(gc, x, y, w, h);
});
return gc.getImage().toBufferedImage();
}

0 comments on commit 4e5f0e6

Please sign in to comment.