harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexei Zakharov (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-4963) [classlib][awt] possible hang up when activate windows-InputMethod if getInputMethodRequests() is overridden
Date Thu, 01 Nov 2007 14:51:50 GMT

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

Alexei Zakharov commented on HARMONY-4963:
------------------------------------------

Chunrong, I've applied your patch at the revision 591027. However, is this patch final? I
still can't get how thread safety issues can be solved by adding an extra initialization.
Could you please explain?

> [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
>            Assignee: Alexei Zakharov
>         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.


Mime
View raw message