Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-2868

clipboard.setMimeData() to clipboard.mimeData() can crash the Python process

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • P5: Not important
    • None
    • 6.7.2
    • PySide
    • None
    • Windows

    Description

      Running the following code should print "Done". Instead, the Python process crashes.

      from PySide6.QtWidgets import QApplication
      
      application = QApplication()
      clipboard = QApplication.clipboard()
      mimeData = clipboard.mimeData()
      try:
          clipboard.setMimeData(mimeData)
      except:
          pass
      print("Done")
      

      It is not unexpected that setMimeData fails (https://doc.qt.io/qt-6/qclipboard.html#mimeData):
      > Note: The pointer returned might become invalidated when the contents of the clipboard changes; either by calling one of the setter functions or externally by the system clipboard changing.

      However, it should not crash Python.

      Attachments

        1. pyside2868_cpp.zip
          0.8 kB
        2. pyside2868_stack.txt
          16 kB
        3. pyside2868.py
          0.4 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            crmaurei Cristian Maureira-Fredes
            bers bers bers
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes