[libbluray-devel] BDJXletContext: use private lock for callback queue destruction.

hpi1 git at videolan.org
Wed Mar 23 11:56:22 CET 2016


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Wed Mar 23 12:32:40 2016 +0200| [70a868c4266e33f6338640f76e4faa4ee75b275c] | committer: hpi1

BDJXletContext: use private lock for callback queue destruction.

Fixes weird deadlock with media callbacks (some other code or Xlet bust be locking context ?)

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

 .../bdj/java/org/videolan/BDJXletContext.java          |   16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/libbluray/bdj/java/org/videolan/BDJXletContext.java b/src/libbluray/bdj/java/org/videolan/BDJXletContext.java
index 57388a7..4f3e725 100644
--- a/src/libbluray/bdj/java/org/videolan/BDJXletContext.java
+++ b/src/libbluray/bdj/java/org/videolan/BDJXletContext.java
@@ -199,6 +199,8 @@ public class BDJXletContext implements javax.tv.xlet.XletContext, javax.microedi
      * Event queues
      */
 
+    private final Object cbLock = new Object();
+
     protected void setEventQueue(EventQueue eq) {
         eventQueue = eq;
     }
@@ -224,21 +226,21 @@ public class BDJXletContext implements javax.tv.xlet.XletContext, javax.microedi
 
     protected boolean putCallback(BDJAction cb)
     {
-        synchronized (this) {
+        synchronized (cbLock) {
             return putCallbackImpl(cb, callbackQueue);
         }
     }
 
     protected boolean putMediaCallback(BDJAction cb)
     {
-        synchronized (this) {
+        synchronized (cbLock) {
             return putCallbackImpl(cb, mediaQueue);
         }
     }
 
     public boolean putUserEvent(BDJAction cb)
     {
-        synchronized (this) {
+        synchronized (cbLock) {
             return putCallbackImpl(cb, userEventQueue);
         }
     }
@@ -488,13 +490,15 @@ public class BDJXletContext implements javax.tv.xlet.XletContext, javax.microedi
         } catch (InvocationTargetException e) {
         }
 
+        synchronized (cbLock) {
+            callbackQueue = null;
+            userEventQueue = null;
+            mediaQueue = null;
+        }
         synchronized (this) {
             threadGroup = null;
             loader = null;
             container = null;
-            callbackQueue = null;
-            userEventQueue = null;
-            mediaQueue = null;
             defaultLooks = null;
             released = true;
         }



More information about the libbluray-devel mailing list