Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8038136

[macosx] Stuck in sun.lwawt.macosx.CCursorManager.nativeGetCursorPosition

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Duplicate
    • Affects Version/s: 7u45
    • Fix Version/s: 9
    • Component/s: client-libs
    • Labels:

      Description

      FULL PRODUCT VERSION :
      java version "1.7.0_45"
      Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
      Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Mac OS X 10.7.5

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      You will need SWT (3.7.2 or 4.3) libraries to run the executable test case. The test case calls SwingUtilities.invokeAndWait but the application in which the issue was originally faced exhibits same behavior with SwingUtilities.invokeLater.

      A DESCRIPTION OF THE PROBLEM :
      On Mac application calls to AWT frame object (Created using SWT_AWT bridge) methods do not return when called from AWT thread.

      Same test case as well as the original application runs fine on Windows platform.

      Thread dump of the stuck thread:
      "AWT-EventQueue-0" prio=5 tid=0x00007fde3c8db000 nid=0x7b03 runnable [0x0000000117520000]
         java.lang.Thread.State: RUNNABLE
      at sun.lwawt.macosx.CCursorManager.nativeGetCursorPosition(Native Method)
      at sun.lwawt.macosx.CCursorManager.getCursorPosition(CCursorManager.java:54)
      at sun.lwawt.LWCursorManager.updateCursorImpl(LWCursorManager.java:79)
      at sun.lwawt.LWCursorManager.updateCursor(LWCursorManager.java:56)
      at sun.lwawt.LWComponentPeer.updateCursorImmediately(LWComponentPeer.java:852)
      at java.awt.Component.updateCursorImmediately(Component.java:3123)
      at java.awt.Component.show(Component.java:1626)
      - locked <0x00000007d59f85d0> (a java.awt.Component$AWTTreeLock)
      at java.awt.Window.show(Window.java:1042)
      at sun.awt.EmbeddedFrame.show(EmbeddedFrame.java:179)
      at java.awt.Component.show(Component.java:1651)
      at java.awt.Component.setVisible(Component.java:1603)
      at java.awt.Window.setVisible(Window.java:1014)
      at Main$2.run(Main.java:54)
      at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:241)
      at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:733)
      at java.awt.EventQueue.access$200(EventQueue.java:103)
      at java.awt.EventQueue$3.run(EventQueue.java:694)
      at java.awt.EventQueue$3.run(EventQueue.java:692)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
      at java.awt.EventQueue.dispatchEvent(EventQueue.java:703)
      at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
      at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
      at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
      at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)




      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Please run the executable test case with needed SWT libraries

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Dialog should appear with a "Submit" button on top an AWT frame.
      ACTUAL -
      Application gets stuck while opening the dialogue.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      "AWT-EventQueue-0" prio=5 tid=0x00007fde3c8db000 nid=0x7b03 runnable [0x0000000117520000]
         java.lang.Thread.State: RUNNABLE
      at sun.lwawt.macosx.CCursorManager.nativeGetCursorPosition(Native Method)
      at sun.lwawt.macosx.CCursorManager.getCursorPosition(CCursorManager.java:54)
      at sun.lwawt.LWCursorManager.updateCursorImpl(LWCursorManager.java:79)
      at sun.lwawt.LWCursorManager.updateCursor(LWCursorManager.java:56)
      at sun.lwawt.LWComponentPeer.updateCursorImmediately(LWComponentPeer.java:852)
      at java.awt.Component.updateCursorImmediately(Component.java:3123)
      at java.awt.Component.show(Component.java:1626)
      - locked <0x00000007d59f85d0> (a java.awt.Component$AWTTreeLock)
      at java.awt.Window.show(Window.java:1042)
      at sun.awt.EmbeddedFrame.show(EmbeddedFrame.java:179)
      at java.awt.Component.show(Component.java:1651)
      at java.awt.Component.setVisible(Component.java:1603)
      at java.awt.Window.setVisible(Window.java:1014)
      at Main$2.run(Main.java:54)
      at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:241)
      at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:733)
      at java.awt.EventQueue.access$200(EventQueue.java:103)
      at java.awt.EventQueue$3.run(EventQueue.java:694)
      at java.awt.EventQueue$3.run(EventQueue.java:692)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
      at java.awt.EventQueue.dispatchEvent(EventQueue.java:703)
      at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
      at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
      at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
      at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.Button;
      import java.awt.Color;
      import java.awt.event.ActionEvent;
      import java.awt.event.ActionListener;
      import java.lang.reflect.InvocationTargetException;

      import javax.swing.JOptionPane;
      import javax.swing.SwingUtilities;

      import org.eclipse.swt.SWT;
      import org.eclipse.swt.awt.SWT_AWT;
      import org.eclipse.swt.layout.GridLayout;
      import org.eclipse.swt.widgets.Display;
      import org.eclipse.swt.widgets.Shell;
      import org.eclipse.swt.widgets.Composite;

      public class Main {

        public static void main(String[] args) {
       
      if(System.getProperty("os.name").toLowerCase().startsWith("mac")){
      SWT_AWT.embeddedFrameClass = "sun.lwawt.macosx.CViewEmbeddedFrame";
      }

          Display display = new Display();
          Shell shell = new Shell(display);
          shell.setText("Shell");
          shell.setSize(200, 200);
          shell.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_BLUE));
          
          final Composite composite = new Composite(shell, SWT.EMBEDDED);
          GridLayout gridLayout = new GridLayout();
          gridLayout.numColumns = 1;
          composite.setLayout(gridLayout);
          composite.setSize(200,200);
          composite.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
         
          final java.awt.Frame frame = SWT_AWT.new_Frame(composite);
          frame.setVisible(false);
      frame.setBackground(Color.red);
      frame.setSize(200, 200);
          Button button = new Button("Submit");
          button.addActionListener(new ActionListener() {

      @Override
      public void actionPerformed(ActionEvent e) {
      JOptionPane.showMessageDialog(null, "Hello");
      }
      });
          frame.add(button);
          frame.doLayout();

          try {
      SwingUtilities.invokeAndWait(new Runnable() {

      @Override
      public void run() {
      frame.setVisible(true);
      }
      });
      } catch (InterruptedException e1) {
      e1.printStackTrace();
      } catch (InvocationTargetException e1) {
      e1.printStackTrace();
      }
          
          shell.open();
          
          while (!shell.isDisposed()) {
            if (!display.readAndDispatch())
              display.sleep();
          }
          display.dispose();
          
          
          
        }
      }
      ---------- END SOURCE ----------

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                pchelko Petr Pchelko (Inactive)
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: