[libbluray-devel] BDKeyboardFocusManagerPeer: do not accept focus changes after dispose()

hpi1 git at videolan.org
Thu Apr 11 18:03:12 CEST 2013


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Thu Apr 11 18:51:39 2013 +0300| [1741b6410617bd49d7417eeccc2781be1860a418] | committer: hpi1

BDKeyboardFocusManagerPeer: do not accept focus changes after dispose()

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

 .../java/awt/peer/BDKeyboardFocusManagerPeer.java         |   13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/libbluray/bdj/java-j2se/java/awt/peer/BDKeyboardFocusManagerPeer.java b/src/libbluray/bdj/java-j2se/java/awt/peer/BDKeyboardFocusManagerPeer.java
index 76ef4a8..b41d77e 100644
--- a/src/libbluray/bdj/java-j2se/java/awt/peer/BDKeyboardFocusManagerPeer.java
+++ b/src/libbluray/bdj/java-j2se/java/awt/peer/BDKeyboardFocusManagerPeer.java
@@ -32,8 +32,9 @@ public class BDKeyboardFocusManagerPeer implements KeyboardFocusManagerPeer {
     public static KeyboardFocusManagerPeer getInstance() {
         java7 = true;
 
-        if (instance == null)
+        if (instance == null) {
             instance = new BDKeyboardFocusManagerPeer();
+        }
         return instance;
     }
 
@@ -79,11 +80,13 @@ public class BDKeyboardFocusManagerPeer implements KeyboardFocusManagerPeer {
 
     private Component focusOwner = null;
     private Window window = null; /* used in java 6 only */
+    private boolean disposed = false;
 
     public void dispose()
     {
         focusOwner = null;
         window = null;
+        disposed = true;
     }
 
     private BDKeyboardFocusManagerPeer() {
@@ -97,12 +100,16 @@ public class BDKeyboardFocusManagerPeer implements KeyboardFocusManagerPeer {
     }
 
     public void setCurrentFocusOwner(Component c) {
-        focusOwner = c;
+        if (!disposed) {
+            focusOwner = c;
+        }
     }
 
     /* java 6 only */
     public void setCurrentFocusedWindow(Window w) {
-        window = w;
+        if (!disposed) {
+            window = w;
+        }
     }
 
     /* java 6 only */



More information about the libbluray-devel mailing list