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

VM crashes if more than one file are added to ClipboardContent via drag and drop

    XMLWordPrintable

Details

    • b20
    • x86
    • os_x_10.15

    Description

      ADDITIONAL SYSTEM INFORMATION :
      macOS 10.15.1

      openjdk version "13.0.1" 2019-10-15
      OpenJDK Runtime Environment (build 13.0.1+9)
      OpenJDK 64-Bit Server VM (build 13.0.1+9, mixed mode, sharing)

      JavaFX 13.0.1


      A DESCRIPTION OF THE PROBLEM :
      When putting more than one file into the ClipboardContent via drag and drop the virtual machine crashes. *Exactly* one file works perfectly, more than one file leads to the creash. The functionality worked fine on Java 11 but produces the crash with Java 13.

      REGRESSION : Last worked in version 11.0.5

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Execute the main method of the attached source code

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The files should be correctly copied to the OS
      ACTUAL -
      The system crashes

      ---

      2019-11-10 00:14:54.299 java[50285:1157021] *** Terminating app due to uncaught exception 'NSGenericException', reason: 'There are 2 items on the pasteboard, but 1 drag images. There must be 1 draggingItem per pasteboardItem.'
      *** First throw call stack:
      (
      0 CoreFoundation 0x00007fff2db3af53 __exceptionPreprocess + 250
      1 libobjc.A.dylib 0x00007fff63c00835 objc_exception_throw + 48
      2 CoreFoundation 0x00007fff2db3ada9 +[NSException raise:format:] + 189
      3 AppKit 0x00007fff2afc93bb -[NSDraggingSession(NSInternal) _initWithPasteboard:image:offset:source:] + 247
      4 AppKit 0x00007fff2afc8dee -[NSCoreDragManager dragImage:fromWindow:at:offset:event:pasteboard:source:slideBack:] + 1889
      5 AppKit 0x00007fff2afc867d -[NSWindow(NSDrag) dragImage:at:offset:event:pasteboard:source:slideBack:] + 134
      6 libglass.dylib 0x0000000132f9f618 -[GlassViewDelegate startDrag:] + 1080
      7 libglass.dylib 0x0000000132faa0c7 Java_com_sun_glass_ui_mac_MacPasteboard__1putItemsFromArray + 2439
      8 ??? 0x000000011c1d8c90 0x0 + 4766665872
      9 ??? 0x000000011c1d2a90 0x0 + 4766640784
      10 ??? 0x000000011c1d2a90 0x0 + 4766640784
      11 ??? 0x000000011c1d2a90 0x0 + 4766640784
      )
      libc++abi.dylib: terminating with uncaught exception of type NSException

      ---------- BEGIN SOURCE ----------
      package test;

      import java.io.File;
      import java.util.List;

      import javafx.application.Application;
      import javafx.scene.Node;
      import javafx.scene.Scene;
      import javafx.scene.control.Label;
      import javafx.scene.input.ClipboardContent;
      import javafx.scene.input.Dragboard;
      import javafx.scene.input.TransferMode;
      import javafx.stage.Stage;

      public class Test {

          public static void main(String[] args) {
              Application.launch(TestApplication.class, args);
          }

          public static class TestApplication extends Application {

              @Override
              public void start(Stage primaryStage) throws Exception {

                  Label label = new Label("HELLO!");
                  label.setOnDragDetected(event -> {
      // List<File> files1 = List.of(new File("/bin/bash"));
                      List<File> files2 = List.of(new File("/bin/bash"), new File("/bin/cat"));
                      Dragboard dragBoard = ((Node)event.getSource()).startDragAndDrop(TransferMode.COPY);
                      ClipboardContent clipboardContent = new ClipboardContent();
                      clipboardContent.putFiles(files2);
                      dragBoard.setContent(clipboardContent);
                      event.consume();
                  });

                  primaryStage.setScene(new Scene(label));
                  primaryStage.show();


              }

          }

      }

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

      CUSTOMER SUBMITTED WORKAROUND :
      Downgrading to a lower Java version. Functionality works fine with Java 11.

      FREQUENCY : always


      Attachments

        Issue Links

          Activity

            People

              lkostyra Lukasz Kostyra
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: