6853617: race condition in java.awt.Font.getAttributes() (private method)
Reviewed-by: igor, jgodinez
--- a/jdk/src/share/classes/java/awt/Font.java Mon Jun 22 09:47:50 2009 -0700
+++ b/jdk/src/share/classes/java/awt/Font.java Mon Jun 22 14:10:09 2009 -0700
@@ -445,18 +445,19 @@
*/
private AttributeValues getAttributeValues() {
if (values == null) {
- values = new AttributeValues();
- values.setFamily(name);
- values.setSize(pointSize); // expects the float value.
+ AttributeValues valuesTmp = new AttributeValues();
+ valuesTmp.setFamily(name);
+ valuesTmp.setSize(pointSize); // expects the float value.
if ((style & BOLD) != 0) {
- values.setWeight(2); // WEIGHT_BOLD
+ valuesTmp.setWeight(2); // WEIGHT_BOLD
}
if ((style & ITALIC) != 0) {
- values.setPosture(.2f); // POSTURE_OBLIQUE
+ valuesTmp.setPosture(.2f); // POSTURE_OBLIQUE
}
- values.defineAll(PRIMARY_MASK); // for streaming compatibility
+ valuesTmp.defineAll(PRIMARY_MASK); // for streaming compatibility
+ values = valuesTmp;
}
return values;