[libbluray-devel] Fix HSceneFactory.dispose(HScene).

hpi1 git at videolan.org
Tue Dec 10 10:24:48 CET 2013


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Tue Dec 10 10:28:48 2013 +0200| [c512316f07f24f91664069b32eb205a4153651f2] | committer: hpi1

Fix HSceneFactory.dispose(HScene).
Never return disposed scene from factory. Fixes Terminator Salvation.

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

 .../bdj/java/org/havi/ui/HSceneFactory.java         |   19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/src/libbluray/bdj/java/org/havi/ui/HSceneFactory.java b/src/libbluray/bdj/java/org/havi/ui/HSceneFactory.java
index ce8d076..9d49060 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HSceneFactory.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HSceneFactory.java
@@ -21,6 +21,7 @@ package org.havi.ui;
 
 import org.videolan.GUIManager;
 import org.videolan.BDJXletContext;
+import org.videolan.Logger;
 
 public class HSceneFactory extends Object {
     private HSceneFactory() {
@@ -97,15 +98,31 @@ public class HSceneFactory extends Object {
     }
 
     public void dispose(HScene scene) {
+
+        if (scene == null) {
+            logger.error("null HScene");
+            return;
+        }
+        if (defaultHScene == null) {
+            logger.error("no HScene created");
+            return;
+        }
+
+        if (!scene.equals(defaultHScene)) {
+            logger.error("wrong HScene");
+        }
+
         GUIManager.getInstance().remove(scene);
+        defaultHScene = null;
     }
 
     public void dispose() {
         synchronized(HSceneFactory.class) {
             dispose(defaultHScene);
-            defaultHScene = null;
         }
     }
 
     private HScene defaultHScene = null;
+
+    private static final Logger logger = Logger.getLogger(HSceneFactory.class.getName());
 }



More information about the libbluray-devel mailing list