changeset 5539:41c08cf957cf

RT-33625 WebView fails to unlock some texture resources
author peterz
date Fri, 25 Oct 2013 14:20:57 +0400
parents ea1fd4f0f16d
children 73faa9d656d2
files modules/web/src/main/java/com/sun/javafx/webkit/prism/WCGraphicsPrismContext.java
diffstat 1 files changed, 11 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/modules/web/src/main/java/com/sun/javafx/webkit/prism/WCGraphicsPrismContext.java	Fri Oct 25 12:14:11 2013 +0200
+++ b/modules/web/src/main/java/com/sun/javafx/webkit/prism/WCGraphicsPrismContext.java	Fri Oct 25 14:20:57 2013 +0400
@@ -1321,7 +1321,7 @@
             try {
                 if (image != null && image instanceof PrismImage) {
                     // blending on canvas
-                    dstImg = (PrDrawable) Effect.createCompatibleImage(fctx, clip.width, clip.height);
+                    dstImg = (PrDrawable) Effect.getCompatibleImage(fctx, clip.width, clip.height);
                     Graphics dstG = dstImg.createGraphics();
                     ((PrismImage) image).draw(dstG,
                             0, 0, clip.width, clip.height,
@@ -1333,7 +1333,7 @@
                     dstImg = PrDrawable.create(fctx, texture);
                 }
 
-                srcImg = (PrDrawable) Effect.createCompatibleImage(fctx, clip.width, clip.height);
+                srcImg = (PrDrawable) Effect.getCompatibleImage(fctx, clip.width, clip.height);
                 Graphics srcG = srcImg.createGraphics();
                 state.apply(srcG);
                 doPaint(srcG);
@@ -1420,9 +1420,15 @@
                 Rectangle outputClip,
                 Object renderHelper,
                 Effect defaultInput) {
-            return new ImageData(fctx, img, new Rectangle(
-                    (int) transform.getMxt(), (int) transform.getMyt(),
-                    width, height));
+            // We have an unpaired lock() here, because unlocking is done
+            // internally by ImageData. See RT-33625 for details.
+            img.lock();
+            ImageData imgData = new ImageData(fctx, img, new Rectangle(
+                                              (int) transform.getMxt(),
+                                              (int) transform.getMyt(),
+                                              width, height));
+            imgData.setReusable(true);
+            return imgData;
         }
 
         @Override public RectBounds getBounds(