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

[linux] Pausing inside D&D event handlers makes system inaccessible

XMLWordPrintable

    • x86_64
    • linux

      FULL PRODUCT VERSION :
      Oracle Corporation 25.152-b16 Java(TM) SE Runtime Environment Java HotSpot(TM) 64-Bit Server VM

      ADDITIONAL OS VERSION INFORMATION :
      Debian (tried it on Jessie as well) Stretch AMD64, Kernel "SMP Debian 4.9.65-3 (2017-12-03) x86_64"
      X.Org X Server 1.19.2 (Release Date: 2017-03-02)
      Eclipse Mars and Oxygen

      A DESCRIPTION OF THE PROBLEM :
      Please consider the simplified demo application attached to this bug report.
      The application is written and debugged using Eclipse (tried Mars and Oxygen), it displays two labels. The left of the two labels (banana peel) can be pulled over the right one (waste bin). Any breakpoints in the onDragDetected or the onDragOver handler will cause the Desktop to become inaccessible when reached.
      'Inaccessible' means the mouse pointer can be moved but it's impossible to click/scroll anything all over the desktop, same applies for key events. The paused application seems to consume all those pointer/key events. The only way to resume to normal operations is to kill the paused demo application (remotely or from a virtual terminal).
      There are quite some suggestions on the web to use the VM-argument "-Dsun.awt.disablegrab=true" but this is not a solution as it prevents the DragOver event from being fired.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      (Advice: First make sure you can log into your Machine remotely, via SSH etc., to be able to kill the application.)
      Set debugging breakpoints in the onDragDetected and/or the onDragOver, start the application in the debugger and drag the left label (yellow) over the right one (gray).

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Application execution should be interrupted when a breakpoint is reached and mouse button, scroll or key stroke events should still be delivered to the respective application.
      ACTUAL -
      Depending on where you put the breakpoints (see comments) the application will be paused and any clicks or keystrokes will be neglected as long as it is alive.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      public class BreakpointBugDemo extends Application{

      private static final DataFormat SERIALIZED_MIME_TYPE = new DataFormat( "application/x-java-serialized-object" );

      public static void main( String[] args ){
      System.out.println( System.getProperty( "java.vendor" ) );
      System.out.println( System.getProperty( "java.vm.version" ) );
      System.out.println( System.getProperty( "java.runtime.name" ) );
      System.out.println( System.getProperty( "java.vm.name" ) );
      launch( args );
      }

      @Override
      public void start( Stage pst ) throws Exception{
      HBox hbx = new HBox();

      Label lbl_from = new Label( "Banana Peel" );
      lbl_from.setStyle( "-fx-border-width: 2px; -fx-background-color: yellow;" );
      lbl_from.setOnDragDetected( drag_evt -> {
      /* will hang on every breakpoint in here (no matter where to break): */
      System.out.println( "Pick" );
      Dragboard db = lbl_from.startDragAndDrop( TransferMode.MOVE );
      db.setDragView( lbl_from.snapshot( null, null ) );
      ClipboardContent cc = new ClipboardContent();
      cc.put( SERIALIZED_MIME_TYPE, "banana peel" );
      db.setContent( cc );
      drag_evt.consume();
      } );

      Label lbl_to = new Label( "Wastebin" );
      lbl_to.setStyle( "-fx-border-width: 2px; -fx-border-color: black; -fx-background-color: darkgrey;" );
      lbl_to.setOnDragOver( dragover_evt -> {
      /* will hang on every breakpoint in here (no matter where to break),
      * but only if the dragged item is from inside this application, for other
      * items (e.g. files picked from the desktop and dragged over this label)
      * breakpoints work as expected, i.e. they interrupt execution without
      * causing inaccessibility: */
      Dragboard db = dragover_evt.getDragboard();
      if( db.hasContent( SERIALIZED_MIME_TYPE ) ){
      dragover_evt.acceptTransferModes( TransferMode.COPY_OR_MOVE );
      dragover_evt.consume();
      }
      } );

      lbl_to.setOnDragDropped( drop_evt -> {
      /* won't hang on any breakpoint in here (i.e. breakpoints work fine): */
      Dragboard db = drop_evt.getDragboard();
      String content = (String) db.getContent( SERIALIZED_MIME_TYPE );
      if( "banana peel".equals( content ) ) {
      drop_evt.setDropCompleted( true );
      drop_evt.consume();
      System.out.println( "Thanks for picking it up!" );
      }
      } );

      hbx.getChildren().addAll( lbl_from, lbl_to );
      Scene scn = new Scene( hbx, 150, 25 );
      pst.setScene( scn );
      pst.show();
      }
      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      (I would really appreciate having one)

      SUPPORT :
      YES

            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: