[libbluray-devel] Fix race

hpi1 git at videolan.org
Wed Jun 3 10:37:50 CEST 2015


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Tue Jun  2 14:08:44 2015 +0300| [a99853e0076b4c89822fe3e8f59e992a32b58f52] | committer: hpi1

Fix race

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

 .../javax/tv/service/selection/ServiceContextFactoryImpl.java    |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/libbluray/bdj/java/javax/tv/service/selection/ServiceContextFactoryImpl.java b/src/libbluray/bdj/java/javax/tv/service/selection/ServiceContextFactoryImpl.java
index e1e8dea..5bbaa88 100644
--- a/src/libbluray/bdj/java/javax/tv/service/selection/ServiceContextFactoryImpl.java
+++ b/src/libbluray/bdj/java/javax/tv/service/selection/ServiceContextFactoryImpl.java
@@ -33,12 +33,14 @@ public class ServiceContextFactoryImpl extends ServiceContextFactory {
         synchronized (ServiceContextFactoryImpl.class) {
             if (instance == null)
                 instance = new ServiceContextFactoryImpl();
+            return instance;
         }
-        return instance;
     }
 
     public static void shutdown() {
-        instance = null;
+        synchronized (ServiceContextFactoryImpl.class) {
+            instance = null;
+        }
     }
 
     public ServiceContext createServiceContext()



More information about the libbluray-devel mailing list