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

Use new, more reliable Windows API for clipboard change notifications

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Done
    • P3: Somewhat important
    • 5.4.0
    • 5.2.0
    • Other
    • None
    • Windows

    • 6a61a00ddb21e79412e82069dfef50192bfd724d (dev, 15.5.2014, 5.4)

    Description

      I once closed five instances of Tableau, a Qt application, and even though the windows disappeared, the processes were hung on system calls to ChangeClipboardChain().

      QWindowsClipboard uses the old Windows clipboard chain API (ChangeClipboardChain) to receive notifications when the clipboard contents change. This API is a badly-designed way for Windows applications to receive clipboard change events – see http://stackoverflow.com/questions/5709311/can-aborting-a-process-without-resetting-the-clipboard-chain-cause-trouble. Any badly-behaving process that uses the clipboard chain could mess the other processes up, even if they handle the clipboard chain correctly.

      An easy fix for Vista and later would be to use AddClipboardFormatListener() and RemoveClipboardFormatListener() in QWindowsClipboard, and change the clipboard message Qt listens for. If there's a way to check for this conditionally, it may be a worthwhile and minor change that makes Qt Windows apps more robust.

      Additionally, it would be nice to have the option to not run the clipboard listening mechanism in QWindowClipboard, as many applications don't care if the clipboard changes. For example, perhaps the hidden listening window could be created as soon as a slot is registered with the QClipboard::changed/dataChanged signals.

      Attachments

        Issue Links

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

          Activity

            People

              kleint Friedemann Kleint
              jbooth Jeff Booth
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: