summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorJozef BABJAK <jozef.babjak@ixonos.com>2011-01-20 08:09:25 +0100
committerJozef BABJAK <jozef.babjak@ixonos.com>2011-02-01 08:53:52 +0100
commit06e57b5d46c87e9dd7bca1386b63b3a8522f51ef (patch)
tree3ae0da78524f8126167ed1e0c64314ec71141075 /services
parent056340ac95f233090990d77266d89aad3b60f913 (diff)
downloadframeworks_base-06e57b5d46c87e9dd7bca1386b63b3a8522f51ef.zip
frameworks_base-06e57b5d46c87e9dd7bca1386b63b3a8522f51ef.tar.gz
frameworks_base-06e57b5d46c87e9dd7bca1386b63b3a8522f51ef.tar.bz2
Fixing possible race condition.
That return statement is effectively a reading of asynchronously modified field. The reading and writing is elsewhere protected by locking on thread instance, except this one occurence. Moving 'return' statement into synchronized block ensures that it reads updated value. Don't be afraid of deadlock - wait() releases the lock and acquires it back when notified. Change-Id: I940c24c04a1a2d4508d14d11b6174ff4fb2ab7d5
Diffstat (limited to 'services')
-rw-r--r--services/java/com/android/server/WindowManagerService.java3
1 files changed, 1 insertions, 2 deletions
diff --git a/services/java/com/android/server/WindowManagerService.java b/services/java/com/android/server/WindowManagerService.java
index f605c11..5b236a7 100644
--- a/services/java/com/android/server/WindowManagerService.java
+++ b/services/java/com/android/server/WindowManagerService.java
@@ -522,9 +522,8 @@ public class WindowManagerService extends IWindowManager.Stub
} catch (InterruptedException e) {
}
}
+ return thr.mService;
}
-
- return thr.mService;
}
static class WMThread extends Thread {