diff options
author | Matthew Johnson <mjj29@hecate.matthew.ath.cx> | 2008-04-18 20:16:12 +0100 |
---|---|---|
committer | Matthew Johnson <mjj29@hecate.matthew.ath.cx> | 2008-04-18 20:16:12 +0100 |
commit | fb8145158aefc9c6e7de5b4ad679e5c9dcbc0530 (patch) | |
tree | 36b7c4fc39fb057cbe051c2f351f9ecc43950819 | |
parent | fdc9fa0f332c93e55f6dd7c203dae935b2c85bc6 (diff) |
fix race condition
-rw-r--r-- | changelog | 2 | ||||
-rw-r--r-- | org/freedesktop/dbus/Message.java | 4 |
2 files changed, 5 insertions, 1 deletions
@@ -3,6 +3,8 @@ Version 2.4.1: * Fix returning DBusSerializables (Spotted by Johannes Felten <johannesfelten -at- googlemail -dot- com>) * Fix CreateInterface (Spotted by Tom Walsh <walshtc -at- gmail -dot- com>) + * Fix serial assignment race condition (Spotted by Ed Wei + <Edward.Wei.03 -at- alum -dot- dartmouth -dot- org>) Version 2.4: diff --git a/org/freedesktop/dbus/Message.java b/org/freedesktop/dbus/Message.java index 4640630..c514002 100644 --- a/org/freedesktop/dbus/Message.java +++ b/org/freedesktop/dbus/Message.java @@ -177,7 +177,9 @@ public class Message headers = new HashMap<Byte, Object>(); big = (Endian.BIG == endian); bytecounter = 0; - serial = ++globalserial; + synchronized (Message.class) { + serial = ++globalserial; + } if (Debug.debug) Debug.print(Debug.DEBUG, "Creating message with serial "+serial); this.type = type; this.flags = flags; |