src/solaris/classes/sun/awt/X11InputMethod.java

Print this page

        

@@ -55,10 +55,11 @@
 
 import java.io.File;
 import java.io.FileReader;
 import java.io.BufferedReader;
 import java.io.IOException;
+import java.lang.ref.WeakReference;
 import sun.util.logging.PlatformLogger;
 import java.util.StringTokenizer;
 import java.util.regex.Pattern;
 
 

@@ -102,11 +103,11 @@
     private static Map[] highlightStyles;
     private boolean disposed = false;
 
     //reset the XIC if necessary
     private boolean   needResetXIC = false;
-    private Component needResetXICClient = null;
+    private WeakReference<Component> needResetXICClient = new WeakReference<>(null);
 
     // The use of compositionEnableSupported is to reduce unnecessary
     // native calls if set/isCompositionEnabled
     // throws UnsupportedOperationException.
     // It is set to false if that exception is thrown first time

@@ -270,18 +271,18 @@
         /* needResetXIC is used to indicate whether to call
            resetXIC on the active client. resetXIC will always be
            called on the passive client when endComposition is called.
         */
         if (needResetXIC && haveActiveClient() &&
-            getClientComponent() != needResetXICClient){
+            getClientComponent() != needResetXICClient.get()){
             resetXIC();
 
             // needs to reset the last xic focussed component.
             lastXICFocussedComponent = null;
             isLastXICActive = false;
 
-            needResetXICClient = null;
+            needResetXICClient.clear();
             needResetXIC = false;
         }
     }
 
     /**

@@ -415,11 +416,11 @@
             setXICFocus(getPeer(lastXICFocussedComponent), false, isLastXICActive);
             lastXICFocussedComponent = null;
             isLastXICActive = false;
 
             resetXIC();
-            needResetXICClient = null;
+            needResetXICClient.clear();
             needResetXIC = false;
         }
     }
 
     // implements java.awt.im.spi.InputMethod.hideWindows

@@ -476,11 +477,11 @@
         // disable the native input method so that the other input
         // method could get the input focus.
         disableInputMethod();
         if (needResetXIC) {
             resetXIC();
-            needResetXICClient = null;
+            needResetXICClient.clear();
             needResetXIC = false;
         }
     }
 
     /**

@@ -875,11 +876,11 @@
            so that it can be restored later. */
         savedCompositionState = getCompositionState();
         boolean active = haveActiveClient();
         if (active && composedText == null && committedText == null){
             needResetXIC = true;
-            needResetXICClient = getClientComponent();
+            needResetXICClient = new WeakReference<>(getClientComponent());
             return;
         }
 
         String text = resetXIC();
         /* needResetXIC is only set to true for active client. So passive