harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chunrong Lai (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-4963) [classlib][awt] possible hang up when activate windows-InputMethod if getInputMethodRequests() is overridden
Date Thu, 18 Oct 2007 03:56:50 GMT
[classlib][awt] possible hang up when activate windows-InputMethod if getInputMethodRequests()
is overridden

                 Key: HARMONY-4963
                 URL: https://issues.apache.org/jira/browse/HARMONY-4963
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
         Environment: Win32
            Reporter: Chunrong Lai

 In debugging of a hangup of some application I see below functions in Harmony:

    public void activate() {
        WinEventQueue.Task task = new WinEventQueue.Task() {
            public void perform() {
                final long hwnd = win32.GetFocus();
                if (hwnd == 0l) return;
                long curIMC = win32.ImmGetContext(hwnd);
                if ((curIMC != 0) && isActiveClient()) {
                    win32.ImmSetOpenStatus(curIMC, 0);
                if (curIMC != hIMC) {                    
                    long res = win32.ImmAssociateContext(hwnd, hIMC);
                } else {
                win32.ImmReleaseContext(hwnd, curIMC);

    private static boolean isActiveClient() {
        InputMethodContext imc = IMManager.getLastActiveIMC();
        if ((imc == null) || (imc.getClient() == null)) {
            return false;
        return (imc.getClient().getInputMethodRequests() != null);

 In my understanding the imc.getClient().getInputMethodRequests(), executed in final WinEventQueue
eventQueue, is thread unsafe if the getInputMethodRequests() is overridden by sub-components.

 The fix can be in several shapes:
  (1) Dispatch the task thread-safely, for example, make it in AWTEventDispatchThread.
  (2) Give a rule to getInputMethodRequests() to avoid free overriding. For example, if getInputMethodRequests()
only return something or initialize something. We can force getClient().getInputMethodRequests()
in InputMethod.activateIM() and InputMethod.switchIM() (to finish the initialization) so it
will be thread-safe in winIM.activate(). 

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message