diff options
author | Denis Lila <[email protected]> | 2011-03-08 09:43:59 -0500 |
---|---|---|
committer | Denis Lila <[email protected]> | 2011-03-08 09:43:59 -0500 |
commit | 847e7b1b2f78e27693d33281bcce54801a7a9ce7 (patch) | |
tree | 0fdfc918e6811a36729bd62d835baeb37b6aed66 /plugin | |
parent | 622e6cdd632cba0fbf1a523a32d6641eec0c6639 (diff) |
Fix race condition.
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/icedteanp/java/sun/applet/PluginAppletViewer.java | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java b/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java index bd3637f..d863f16 100644 --- a/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java +++ b/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java @@ -356,7 +356,8 @@ public class PluginAppletViewer extends XEmbeddedFrame public static final int APPLET_TIMEOUT = 180000; - private static Long requestIdentityCounter = 0L; + private static final Object requestMutex = new Object(); + private static long requestIdentityCounter = 0L; private Image bufFrameImg; private Graphics bufFrameImgGraphics; @@ -990,11 +991,11 @@ public class PluginAppletViewer extends XEmbeddedFrame * * @return A unique Long identifier for the request */ - private static Long getRequestIdentifier() { - synchronized (requestIdentityCounter) { - - if (requestIdentityCounter == Long.MAX_VALUE) + private static long getRequestIdentifier() { + synchronized(requestMutex) { + if (requestIdentityCounter == Long.MAX_VALUE) { requestIdentityCounter = 0L; + } return requestIdentityCounter++; } |