Bug 726382 - Ensure the mDir and mMozDir variables are protected by synchronization. r=rnewman

It is possible that two threads will call getDir(), or getDir() and
moveProfilesToAppInstallLocation() simultaneously. Without this patch,
this would attempt to double-create the mozilla or profile directories,
which would then result in an IOException and failure when it shouldn't.
This commit is contained in:
Kartikaya Gupta 2012-02-26 18:08:03 -05:00
parent 252040f7c7
commit acdd08d8b5

View File

@ -61,7 +61,7 @@ public final class GeckoProfile {
mName = profileName;
}
public File getDir() {
public synchronized File getDir() {
if (mDir != null) {
return mDir;
}
@ -280,7 +280,7 @@ public final class GeckoProfile {
return success;
}
private File ensureMozillaDirectory() throws IOException {
private synchronized File ensureMozillaDirectory() throws IOException {
if (mMozDir != null) {
return mMozDir;
}