src/java.desktop/unix/classes/sun/awt/X11/XClipboard.java

Print this page

        

@@ -154,10 +154,12 @@
     protected void registerClipboardViewerChecked() {
         // for XConvertSelection() to be called for the first time in getTargetsDelayed()
         isSelectionNotifyProcessed = true;
 
         boolean mustSchedule = false;
+        XToolkit.awtLock();
+        try {
         synchronized (XClipboard.classLock) {
             if (targetsAtom2Clipboard == null) {
                 targetsAtom2Clipboard = new HashMap<Long, XClipboard>(2);
             }
             mustSchedule = targetsAtom2Clipboard.isEmpty();

@@ -168,10 +170,13 @@
             }
         }
         if (mustSchedule) {
             XToolkit.schedule(new CheckChangeTimerTask(), XClipboard.getPollInterval());
         }
+        } finally {
+            XToolkit.awtUnlock();
+        }
     }
 
     private static class CheckChangeTimerTask implements Runnable {
         public void run() {
             for (XClipboard clpbrd : targetsAtom2Clipboard.values()) {