Bug 658177 - Fix potential deadlock in gVolumeScaleLock. r=roc
authorChris Pearce <chris@pearce.org.nz>
Thu, 19 May 2011 21:00:39 +1200
changeset 69687 7ef763ba534b75393923f83ff72f48db2048d3d0
parent 69686 d22583a11f15ce63bbadd9c4a000cc003151562c
child 69689 4fd08a1e0644afe1ec180b4730e3d81ff4423044
push idunknown
push userunknown
push dateunknown
reviewersroc
bugs658177
milestone6.0a1
Bug 658177 - Fix potential deadlock in gVolumeScaleLock. r=roc
content/media/nsAudioStream.cpp
--- a/content/media/nsAudioStream.cpp
+++ b/content/media/nsAudioStream.cpp
@@ -316,19 +316,19 @@ class AudioShutdownEvent : public nsRunn
   nsRefPtr<AudioChild> mAudioChild;
 };
 
 static mozilla::Mutex* gVolumeScaleLock = nsnull;
 
 static double gVolumeScale = 1.0;
 
 static int VolumeScaleChanged(const char* aPref, void *aClosure) {
-  mozilla::MutexAutoLock lock(*gVolumeScaleLock);
   nsAdoptingString value =
     nsContentUtils::GetStringPref("media.volume_scale");
+  mozilla::MutexAutoLock lock(*gVolumeScaleLock);
   if (value.IsEmpty()) {
     gVolumeScale = 1.0;
   } else {
     NS_ConvertUTF16toUTF8 utf8(value);
     gVolumeScale = PR_MAX(0, PR_strtod(utf8.get(), nsnull));
   }
   return 0;
 }