changeset 2626:9ef423f94e8c

PR1741: Synchronize access to shared variable The variable writeInterrupted is accessed everywhere while holding a lock on 'this' object, except in one location. Fix that. 2012-06-28 Omair Majid <omajid@redhat.com> * pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourceDataLine.java (write): Synchronize access to writeInterrupted flag.
author Omair Majid <omajid@redhat.com>
date Thu, 28 Jun 2012 20:04:54 -0400
parents 9b0027357967
children aa2257220561
files ChangeLog pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourceDataLine.java
diffstat 2 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Sep 29 16:59:04 2011 +0200
+++ b/ChangeLog	Thu Jun 28 20:04:54 2012 -0400
@@ -1,3 +1,8 @@
+2012-06-28  Omair Majid  <omajid@redhat.com>
+
+	* pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourceDataLine.java
+	(write): Synchronize access to writeInterrupted flag.
+
 2011-09-29  Xerxes RĂ„nby  <xerxes@zafena.se>
 	    David Henningsson <david.henningsson@canonical.com>
 
--- a/pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourceDataLine.java	Thu Sep 29 16:59:04 2011 +0200
+++ b/pulseaudio/src/java/org/classpath/icedtea/pulseaudio/PulseAudioSourceDataLine.java	Thu Jun 28 20:04:54 2012 -0400
@@ -179,8 +179,10 @@
             synchronized (eventLoop.threadLock) {
 
                 do {
-                    if (writeInterrupted) {
-                        return sizeWritten;
+                    synchronized (this) {
+                        if (writeInterrupted) {
+                            return sizeWritten;
+                        }
                     }
 
                     if (availableSize == -1) {