[libbluray-devel] EventManager: clean up at shutdown

hpi1 git at videolan.org
Fri Apr 25 10:47:13 CEST 2014


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Fri Apr 25 09:33:56 2014 +0300| [b3a138ffd39c9ed721fd04854be50aad44470d45] | committer: hpi1

EventManager: clean up at shutdown

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

 src/libbluray/bdj/java/org/dvb/event/EventManager.java |   14 ++++++++++++++
 src/libbluray/bdj/java/org/videolan/Libbluray.java     |    1 +
 2 files changed, 15 insertions(+)

diff --git a/src/libbluray/bdj/java/org/dvb/event/EventManager.java b/src/libbluray/bdj/java/org/dvb/event/EventManager.java
index f75bfaf..e7c2194 100644
--- a/src/libbluray/bdj/java/org/dvb/event/EventManager.java
+++ b/src/libbluray/bdj/java/org/dvb/event/EventManager.java
@@ -44,6 +44,20 @@ public class EventManager implements ResourceServer {
         return instance;
     }
 
+    public static void shutdown() {
+        EventManager e;
+        synchronized (EventManager.class) {
+            e = instance;
+            instance = null;
+        }
+        if (e != null) {
+            e.exclusiveUserEventListener.clear();
+            e.sharedUserEventListener.clear();
+            e.exclusiveAWTEventListener.clear();
+            e.resourceStatusEventListeners.clear();
+        }
+    }
+
     public boolean addUserEventListener(UserEventListener listener, ResourceClient client, UserEventRepository userEvents)
         throws IllegalArgumentException {
         if (client == null)
diff --git a/src/libbluray/bdj/java/org/videolan/Libbluray.java b/src/libbluray/bdj/java/org/videolan/Libbluray.java
index 1be3794..f6b61ed 100644
--- a/src/libbluray/bdj/java/org/videolan/Libbluray.java
+++ b/src/libbluray/bdj/java/org/videolan/Libbluray.java
@@ -138,6 +138,7 @@ public class Libbluray {
             BDToolkit.shutdownDisc();
             SIManagerImpl.shutdown();
             IxcRegistry.shutdown();
+            EventManager.shutdown();
             Status.shutdown();
         } catch (Throwable e) {
             e.printStackTrace();



More information about the libbluray-devel mailing list