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

QClipboard mimeData() corruption

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P4: Low
    • 5.8.0
    • 5.5.1
    • GUI: Window management
    • None
    • Doc note: a45673978627fc1ee4ba336caf545b56d44dedec (qtbase/5.8, 30.9.2016,5.8)

    Description

      Given the following use case

      const QMimeData * data = qApp->clipboard()->mimeData();
      qApp->clipboard()->setText("anything");
      doSomething(data); // here, data has potentially been deleted under the hood.

      This popped up because I needed to temporarily put something on the system clipboard (interacting with an external application with a less than desirable interface), which lead to fairly consistent crashes. Originally, doSomething was making a copy and setting on the clipboard. The solution seems to have been to make a copy before changing the clipboard, but the clipboard changing is potentially outside of the control of the programmer. Can either a. the documentation be updated and/or b. some sort of QMimeData copy mechanism be introduced?

      Attachments

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

        Activity

          People

            docteam Qt Documentation Team
            aelm Andrew Forrest
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes