[libbluray-devel] BDWindowGraphics: do not draw if already disposed

hpi1 git at videolan.org
Thu Nov 19 14:43:12 CET 2015


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Sun Nov  8 22:57:43 2015 +0200| [64c4118647ece9b9ddfba1aeef4c5c4b4e996361] | committer: hpi1

BDWindowGraphics: do not draw if already disposed

> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=64c4118647ece9b9ddfba1aeef4c5c4b4e996361
---

 src/libbluray/bdj/java/java/awt/BDWindowGraphics.java |   17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/src/libbluray/bdj/java/java/awt/BDWindowGraphics.java b/src/libbluray/bdj/java/java/awt/BDWindowGraphics.java
index 743f441..26e7248 100644
--- a/src/libbluray/bdj/java/java/awt/BDWindowGraphics.java
+++ b/src/libbluray/bdj/java/java/awt/BDWindowGraphics.java
@@ -39,6 +39,7 @@ public class BDWindowGraphics extends BDGraphics {
     }
 
     public void clearRect(int x, int y, int w, int h) {
+        if (window == null) return;
         synchronized (window) {
             super.clearRect(x, y, w, h);
             window.notifyChanged();
@@ -46,6 +47,7 @@ public class BDWindowGraphics extends BDGraphics {
     }
 
     public void fillRect(int x, int y, int w, int h) {
+        if (window == null) return;
         synchronized (window) {
             super.fillRect(x, y, w, h);
             window.notifyChanged();
@@ -53,6 +55,7 @@ public class BDWindowGraphics extends BDGraphics {
     }
 
     public void drawRect(int x, int y, int w, int h) {
+        if (window == null) return;
         synchronized (window) {
             super.drawRect(x, y, w, h);
             window.notifyChanged();
@@ -60,6 +63,7 @@ public class BDWindowGraphics extends BDGraphics {
     }
 
     public void drawLine(int x1, int y1, int x2, int y2) {
+        if (window == null) return;
         synchronized (window) {
             super.drawLine(x1, y1, x2, y2);
             window.notifyChanged();
@@ -67,6 +71,7 @@ public class BDWindowGraphics extends BDGraphics {
     }
 
     public void copyArea(int x, int y, int w, int h, int dx, int dy) {
+        if (window == null) return;
         synchronized (window) {
             super.copyArea(x, y, w, h, dx, dy);
             window.notifyChanged();
@@ -74,6 +79,7 @@ public class BDWindowGraphics extends BDGraphics {
     }
 
     public void drawPolyline(int xPoints[], int yPoints[], int nPoints) {
+        if (window == null) return;
         synchronized (window) {
             super.drawPolyline(xPoints, yPoints, nPoints);
             window.notifyChanged();
@@ -81,6 +87,7 @@ public class BDWindowGraphics extends BDGraphics {
     }
 
     public void drawPolygon(int xPoints[], int yPoints[], int nPoints) {
+        if (window == null) return;
         synchronized (window) {
             super.drawPolygon(xPoints, yPoints, nPoints);
             window.notifyChanged();
@@ -88,6 +95,7 @@ public class BDWindowGraphics extends BDGraphics {
     }
 
     public void fillPolygon(int xPoints[], int yPoints[], int nPoints) {
+        if (window == null) return;
         synchronized (window) {
             super.fillPolygon(xPoints, yPoints, nPoints);
             window.notifyChanged();
@@ -95,6 +103,7 @@ public class BDWindowGraphics extends BDGraphics {
     }
 
     public void drawOval(int x, int y, int w, int h) {
+        if (window == null) return;
         synchronized (window) {
             super.drawOval(x, y, w, h);
             window.notifyChanged();
@@ -102,6 +111,7 @@ public class BDWindowGraphics extends BDGraphics {
     }
 
     public void fillOval(int x, int y, int w, int h) {
+        if (window == null) return;
         synchronized (window) {
             super.fillOval(x, y, w, h);
             window.notifyChanged();
@@ -109,6 +119,7 @@ public class BDWindowGraphics extends BDGraphics {
     }
 
     public void drawArc(int x, int y, int w, int h, int startAngle, int endAngle) {
+        if (window == null) return;
         synchronized (window) {
             super.drawArc(x, y, w, h, startAngle, endAngle);
             window.notifyChanged();
@@ -116,6 +127,7 @@ public class BDWindowGraphics extends BDGraphics {
     }
 
     public void fillArc(int x, int y, int w, int h, int startAngle, int endAngle) {
+        if (window == null) return;
         synchronized (window) {
             super.fillArc(x, y, w, h, startAngle, endAngle);
             window.notifyChanged();
@@ -123,6 +135,7 @@ public class BDWindowGraphics extends BDGraphics {
     }
 
     public void drawRoundRect(int x, int y, int w, int h, int arcWidth, int arcHeight) {
+        if (window == null) return;
         synchronized (window) {
             super.drawRoundRect(x, y, w, h, arcWidth, arcHeight);
             window.notifyChanged();
@@ -130,6 +143,7 @@ public class BDWindowGraphics extends BDGraphics {
     }
 
     public void fillRoundRect(int x, int y, int w, int h, int arcWidth, int arcHeight) {
+        if (window == null) return;
         synchronized (window) {
             super.fillRoundRect(x, y, w, h, arcWidth, arcHeight);
             window.notifyChanged();
@@ -137,6 +151,7 @@ public class BDWindowGraphics extends BDGraphics {
     }
 
     protected void drawStringN(long ftFace, String string, int x, int y, int rgb) {
+        if (window == null) return;
         synchronized (window) {
             super.drawStringN(ftFace, string, x, y, rgb);
             window.notifyChanged();
@@ -154,6 +169,8 @@ public class BDWindowGraphics extends BDGraphics {
         boolean flipX, boolean flipY,
         Color bg, ImageObserver observer) {
 
+        if (window == null) return true;
+
         synchronized (window) {
             boolean complete = super.drawImageN(
                 img, dx, dy, dw, dh, sx, sy, sw, sh,



More information about the libbluray-devel mailing list