You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Chunrong Lai (JIRA)" <ji...@apache.org> on 2007/10/29 06:39:50 UTC

[jira] Updated: (HARMONY-4963) [classlib][awt] possible hang up when activate windows-InputMethod if getInputMethodRequests() is overridden

     [ https://issues.apache.org/jira/browse/HARMONY-4963?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Chunrong Lai updated HARMONY-4963:
----------------------------------

    Attachment: H4963.1.patch


 Here is the patch.

> [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
>         Attachments: H4963.1.patch
>
>
>  In debugging of a hangup of some application I see below functions in Harmony:
>  modules\awt\src\main\java\windows\org\apache\harmony\awt\wtk\windows:
>     public void activate() {
>         WinEventQueue.Task task = new WinEventQueue.Task() {
>             @Override
>             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);
>             }
>         };
>         wwf.eventQueue.performTask(task);
>         .....
>     }    
>     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.