[libbluray-devel] Make sure GUIManager is shut down
hpi1
git at videolan.org
Sat Mar 30 01:39:08 CET 2013
libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Sat Mar 16 14:19:53 2013 +0200| [57188661ac34e6f6afcdc8dc35f3b57c1277f5d4] | committer: hpi1
Make sure GUIManager is shut down
> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=57188661ac34e6f6afcdc8dc35f3b57c1277f5d4
---
src/libbluray/bdj/java/org/videolan/BDJLoader.java | 2 +-
.../bdj/java/org/videolan/GUIManager.java | 25 ++++++++++++++++++--
src/libbluray/bdj/java/org/videolan/Libbluray.java | 1 +
3 files changed, 25 insertions(+), 3 deletions(-)
diff --git a/src/libbluray/bdj/java/org/videolan/BDJLoader.java b/src/libbluray/bdj/java/org/videolan/BDJLoader.java
index 6e92eb8..9c0042f 100644
--- a/src/libbluray/bdj/java/org/videolan/BDJLoader.java
+++ b/src/libbluray/bdj/java/org/videolan/BDJLoader.java
@@ -135,7 +135,7 @@ public class BDJLoader {
}
// start bdj window
- GUIManager gui = GUIManager.getInstance();
+ GUIManager gui = GUIManager.createInstance();
GraphicsResolution res = bdjo.getTerminalInfo().getResolution();
gui.setResizable(true);
gui.setSize(res.getWidth(), res.getHeight());
diff --git a/src/libbluray/bdj/java/org/videolan/GUIManager.java b/src/libbluray/bdj/java/org/videolan/GUIManager.java
index 30a49cb..ad687a7 100644
--- a/src/libbluray/bdj/java/org/videolan/GUIManager.java
+++ b/src/libbluray/bdj/java/org/videolan/GUIManager.java
@@ -30,9 +30,18 @@ public class GUIManager extends BDRootWindow {
private GUIManager() {
}
- public static synchronized GUIManager getInstance() {
- if (instance == null)
+ public static synchronized GUIManager createInstance() {
+ if (instance == null) {
instance = new GUIManager();
+ }
+ return instance;
+ }
+
+ public static synchronized GUIManager getInstance() {
+ if (instance == null) {
+ Logger.getLogger("GUIManager").error("getInstance(): no instance !");
+ throw new Error("no GUIManager instance");
+ }
return instance;
}
@@ -56,6 +65,18 @@ public class GUIManager extends BDRootWindow {
return null;
}
+ protected static void shutdown() throws Throwable {
+ synchronized (GUIManager.class) {
+ if (instance != null) {
+ instance.setVisible(false);
+ instance.removeAll();
+ instance.dispose();
+ //instance.finalize();
+ instance = null;
+ }
+ }
+ }
+
private static GUIManager instance = null;
private static final long serialVersionUID = 8670041014494973439L;
}
diff --git a/src/libbluray/bdj/java/org/videolan/Libbluray.java b/src/libbluray/bdj/java/org/videolan/Libbluray.java
index 376d9d9..7b88a36 100644
--- a/src/libbluray/bdj/java/org/videolan/Libbluray.java
+++ b/src/libbluray/bdj/java/org/videolan/Libbluray.java
@@ -126,6 +126,7 @@ public class Libbluray {
BDJActionManager.getInstance().finalize();
MountManager.unmountAll();
org.havi.ui.HSceneFactory.shutdown();
+ GUIManager.shutdown();
} catch (Throwable e) {
e.printStackTrace();
}
More information about the libbluray-devel
mailing list