7160623: [macosx] Editable TextArea/TextField are blocking GUI applications from exit
authorserb
Thu, 03 May 2012 18:29:00 +0400
changeset 12639 c1634bcec0a8
parent 12535 6d2ee83614e8
child 12640 5ea775607d72
7160623: [macosx] Editable TextArea/TextField are blocking GUI applications from exit Reviewed-by: anthony, art
jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java
jdk/src/macosx/classes/sun/lwawt/LWTextComponentPeer.java
--- a/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java	Wed May 02 17:54:18 2012 +0400
+++ b/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java	Thu May 03 18:29:00 2012 +0400
@@ -372,7 +372,7 @@
     }
 
     @Override
-    public void dispose() {
+    public final void dispose() {
         if (disposed.compareAndSet(false, true)) {
             disposeImpl();
         }
--- a/jdk/src/macosx/classes/sun/lwawt/LWTextComponentPeer.java	Wed May 02 17:54:18 2012 +0400
+++ b/jdk/src/macosx/classes/sun/lwawt/LWTextComponentPeer.java	Thu May 03 18:29:00 2012 +0400
@@ -81,6 +81,18 @@
         firstChangeSkipped = true;
     }
 
+    @Override
+    protected final void disposeImpl() {
+        synchronized (getDelegateLock()) {
+            // visible caret has a timer thread which must be stopped
+            getTextComponent().getCaret().setVisible(false);
+        }
+        super.disposeImpl();
+    }
+
+    /**
+     * This method should be called under getDelegateLock().
+     */
     abstract JTextComponent getTextComponent();
 
     public Dimension getPreferredSize(final int rows, final int columns) {