System.Exit() Hangs after clipboard.

From: Kevin (kdummer_at_surfaceoptics.com)
Date: 04/30/04


Date: Fri, 30 Apr 2004 09:12:27 -0700


Hello,

On Linux RedHat 9.0 I am using the Clipboard to cut paste in and out of
my application and all is OK. But after I post anything to the
clipboard I can no longer exit my application. The last command I
execute is System.exit(0) but my window never exits and my application
is hung;
Is there some other cleanup required when I have accessed the system
toolkit?

Thanks

     private void addClipboard(){
       SecurityManager sm = System.getSecurityManager();
       if (sm != null) {
         try {
            sm.checkSystemClipboardAccess();
            }
         catch (Exception e) {e.printStackTrace();}
         }
        Toolkit tk = Toolkit.getDefaultToolkit();
        cp = tk.getSystemClipboard();

     }
     public void lostOwnership(Clipboard clip, Transferable tr) {
        System.out.println("Lost Clipboard Ownership?!?");
     }
     public void toClipboard(StringSelection st) {
        if(st !=null){
           cp.setContents(st, this);
        }
     }