src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java

Print this page

        

@@ -855,11 +855,21 @@
         }
     }
 
     private void flushBuffers() {
         if (isVisible() && !nativeBounds.isEmpty()) {
-            LWCToolkit.getLWCToolkit().flushPendingEventsOnAppkit(target);
+            try {
+                //Post an empty runnable to the eventQueue and wait for it to finish,
+                //Selectors continue to be processed on the Appkit Thread
+                LWCToolkit.invokeAndWait(new Runnable() {
+                    @Override
+                    public void run() {
+                    }
+                }, target);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
         }
     }
 
     /*************************************************************
      * Callbacks from the AWTWindow and AWTView objc classes.