Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-106115

Internal drag crashes after dragging files from Finder

    XMLWordPrintable

Details

    • Bug
    • Resolution: Incomplete
    • P1: Critical
    • None
    • 6.3.0
    • GUI: Drag and Drop
    • None
    • macOS

    Description

      Reproduction steps:

      1. Drag n drop some files from the Finder to the application
      2. Once the files drop is acepted, initial a single drag within the application
      3. Qt crahes with
        Terminating app due to uncaught exception 'NSGenericException', reason: 'There are 10 items on the pasteboard, but 1 drag images. There must be 1 draggingItem per pasteboardItem.

         

      Note:

      In 

      bool QCocoaDrag::maybeDragMultipleItems(){    
          ...
      
          // *** sometimes when qtUrls.size() is 1, the number of items in the cocoa paste
          // board is still the same as the previous drag from the OS. The condition below will leave this function,
          // and use the deprecated API `dragImage:at:offset:event:pasteboard:source:slideBack:` and cause an exception then crash.
          //
          // What I do to workaround this is to make the condition check below:
          // if (qtUrls.size() <= 1 && [dragBoard.pasteboardItems count] <= 1)
          // 
          if (qtUrls.size() <= 1) {        
              // Good old -dragImage: works perfectly for this ...        
              return false;    
          }
      
          ...
      }

       

       

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            tpochep Timur Pocheptsov
            eriche Eric He
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes