[libbluray-devel] BDRootWindow: fixed race. It was possible to execute overlay close while overlay update was currently running.

hpi1 git at videolan.org
Tue Jun 11 15:15:56 CEST 2013


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Tue Jun 11 11:29:28 2013 +0300| [33b0b59e798d24272f69763601364980d86ebcd9] | committer: hpi1

BDRootWindow: fixed race. It was possible to execute overlay close while overlay update was currently running.

This resulted application callback being called from two different threads in paraller.
Overlay was freed while being updated by another thread, leading to random crashes and memory corruption.

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

 src/libbluray/bdj/java/java/awt/BDRootWindow.java |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/libbluray/bdj/java/java/awt/BDRootWindow.java b/src/libbluray/bdj/java/java/awt/BDRootWindow.java
index 2491e1d..b49de44 100644
--- a/src/libbluray/bdj/java/java/awt/BDRootWindow.java
+++ b/src/libbluray/bdj/java/java/awt/BDRootWindow.java
@@ -116,9 +116,11 @@ public class BDRootWindow extends Frame {
     }
 
     private void close() {
-        if (overlay_open) {
-            Libbluray.updateGraphic(0, 0, null);
-            overlay_open = false;
+        synchronized (this) {
+            if (overlay_open) {
+                Libbluray.updateGraphic(0, 0, null);
+                overlay_open = false;
+            }
         }
     }
 



More information about the libbluray-devel mailing list