You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Alexey A. Ivanov (JIRA)" <ji...@apache.org> on 2006/11/27 16:55:22 UTC

[jira] Commented: (HARMONY-2030) [classlib][awt] JComponent doesn't send 'removed' event

    [ http://issues.apache.org/jira/browse/HARMONY-2030?page=comments#action_12453626 ] 
            
Alexey A. Ivanov commented on HARMONY-2030:
-------------------------------------------

This is not a completely valid test. If you move all code creating and accessing Swing component to Event Dispatch Thread, you'll get two 'removed' in console when run against Harmony.

This also reveals incompatibility: removed is called twice in Harmony.
And another one is AWT locks are not correctly handled when run concurrently from different threads.

> [classlib][awt] JComponent doesn't send 'removed' event
> -------------------------------------------------------
>
>                 Key: HARMONY-2030
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2030
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Denis Kishenko
>
> When JComponent becomes invisible, it doesn't send 'removed' event to its ancestorListeners 
> ========== Test ==========
> import javax.swing.*;
> import javax.swing.event.*;
> public class Test {
>    public static void main(String[] string) throws Exception {
>             AncestorListenerImpl al = new AncestorListenerImpl();
>             JWindow window = new JWindow();
>             JComponent jc = new JComponent() {
>             };
>             window.getContentPane().add(jc);
>             window.setVisible(true);
>             jc.setVisible(true);
>             jc.addAncestorListener(al);
>             jc.setVisible(false);
>             Thread.sleep(1000);
>             System.out.println("finish");
>             System.exit(0);
>    }
> }
> class AncestorListenerImpl implements AncestorListener {
>     public void ancestorAdded(AncestorEvent arg0) {
>         System.err.println("added");
>     }
>     public void ancestorMoved(AncestorEvent arg0) {
>        System.err.println("moved");
>     }
>     public void ancestorRemoved(AncestorEvent arg0) {
>         System.err.println("removed");
>     }
> }
> ======== RI ===========
> removed
> finish
> =========== Harmony ========
> java.lang.RuntimeException: Not owner can't unlock resource.
> 	at org.apache.harmony.awt.wtk.Synchronizer.unlock(Synchronizer.java:115)
> 	at java.awt.Toolkit.unlockAWT(Toolkit.java:391)
> 	at java.awt.Component.show(Component.java:3095)
> 	at java.awt.Component.show(Component.java:3102)
> 	at java.awt.Component.setVisible(Component.java:3075)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira