You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by te...@apache.org on 2006/11/01 00:13:44 UTC
svn commit: r469700 -
/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/TextComponent.java
Author: tellison
Date: Tue Oct 31 15:13:43 2006
New Revision: 469700
URL: http://svn.apache.org/viewvc?view=rev&rev=469700
Log:
Apply patch HARMONY-1627 ([classlib][awt] CaffeineMark 3.0 sometimes fails with NPE on Dialog benchmark)
Modified:
incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/TextComponent.java
Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/TextComponent.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/TextComponent.java?view=diff&rev=469700&r1=469699&r2=469700
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/TextComponent.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/TextComponent.java Tue Oct 31 15:13:43 2006
@@ -349,7 +349,9 @@
try {
int start = Math.min(dot, mark);
int length = Math.abs(dot - mark);
- document.replace(start, length, text, null);
+ synchronized(TextComponent.this) {
+ document.replace(start, length, text, null);
+ }
} catch (final BadLocationException e) {
}
}
@@ -823,7 +825,9 @@
caret.setDot(0, caret.getDotBias());
}
int oldCaretPos = caret.getDot();
- document.replace(0, document.getLength(), text, null);
+ synchronized (this) {
+ document.replace(0, document.getLength(), text, null);
+ }
if (!isDisplayable() && (oldCaretPos != caret.getDot())) {
// return caret back to emulate "no movement"
caret.setDot(oldCaretPos, caret.getDotBias());
@@ -986,8 +990,14 @@
Rectangle client = getClient();
Shape oldClip = g.getClip();
g.clipRect(client.x, client.y, client.width, client.height);
- rootViewContext.getView().paint(g, r);
- caret.paint(g);
+ document.readLock();
+ try {
+ rootViewContext.getView().paint(g, r);
+ caret.paint(g);
+ } finally {
+ document.readUnlock();
+ }
+
g.setClip(oldClip);
}