[libbluray-devel] org.dvb.event.EventManager: make deep copy of event interest lists.

hpi1 git at videolan.org
Sat Dec 21 08:52:25 CET 2013


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Thu Dec 19 10:15:42 2013 +0200| [3fcffbe722a9ae66d0ad4402b48370b653fbdc10] | committer: hpi1

org.dvb.event.EventManager: make deep copy of event interest lists.

Changing events after listener has been registered breaks the semantics of exclusive listeners.

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

 src/libbluray/bdj/java/org/dvb/event/EventManager.java    |    2 +-
 .../bdj/java/org/dvb/event/UserEventRepository.java       |   13 +++++++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/libbluray/bdj/java/org/dvb/event/EventManager.java b/src/libbluray/bdj/java/org/dvb/event/EventManager.java
index c23ce24..3b89f0a 100644
--- a/src/libbluray/bdj/java/org/dvb/event/EventManager.java
+++ b/src/libbluray/bdj/java/org/dvb/event/EventManager.java
@@ -235,7 +235,7 @@ public class EventManager implements ResourceServer {
             this.context = context;
             this.listener = listener;
             this.client = client;
-            this.userEvents = userEvents;
+            this.userEvents = userEvents.getNewInstance();
         }
 
         public BDJXletContext context;
diff --git a/src/libbluray/bdj/java/org/dvb/event/UserEventRepository.java b/src/libbluray/bdj/java/org/dvb/event/UserEventRepository.java
index f0432b4..5888608 100644
--- a/src/libbluray/bdj/java/org/dvb/event/UserEventRepository.java
+++ b/src/libbluray/bdj/java/org/dvb/event/UserEventRepository.java
@@ -144,5 +144,18 @@ public class UserEventRepository extends RepositoryDescriptor {
         return false;
     }
 
+    /* deep copy */
+
+    private UserEventRepository(UserEventRepository r)
+    {
+        super(r.getClient(), r.getName());
+        events = ((LinkedList)r.events.clone());
+    }
+
+    protected UserEventRepository getNewInstance()
+    {
+        return new UserEventRepository(this);
+    }
+
     private LinkedList events = new LinkedList();
 }



More information about the libbluray-devel mailing list