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

Unreliable paste from system clipboard (X11/Wayland)



    • Type: Bug
    • Status: Open
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 5.13.0 Alpha 1, 5.14.2
    • Fix Version/s: None
    • Component/s: QPA: X11/XCB
    • Labels:
    • Environment:
      * Debian testing with KDE Plasma or Xfce
      * qtbase built from the "dev" git branch (as of commit c212128a676aa906fdef79c3e5ccecf0d942e68c)
    • Platform/s:


      Retrieving data from the system clipboard does not always seem to work reliably, at least on GNU/Linux.

      One way to reproduce problems is the following example that reads and outputs the text and HTML content from the clipboard every 500 ms:


      1) compile and run attached sample (main.cpp)

      2) Open attached HTML file (tdf123115.html) in Firefox. The file contains a large table.

      3) select the whole table, copy to the clipboard (e.g. using Ctrl+V)

      4) keep the sample program running for a while, then observe the output it generates

      An example output is attached as "output_clipboard_test.txt".



      • The output for the HTML copied from the clipboard is always empty from the point where the table was copied from Firefox ('HTML:  ""' in the output).
      • The output for the text representation copied from the clipboard contains the table content most of the times, but is sometimes empty in between (e.g. at line 101, 115, 124 in the attached sample output) without the system clipboard content having changed.

      Expected result:

      • The result of retrieving the clipboard content should always be the same as long as the clipboard content doesn't change.
      • For the given example: The output for both text and HTML should always contain a representation of the whole table copied from Firefox from the point on where it was copied to the system clipboard.


      The output of another example, where just short text passages where copied from https://stackoverflow.com/questions/52204996/how-do-i-use-clipboard-in-gtk is also attached as "sample_output_2.txt". Notice in particular that (at the bottom of the log) "As an example, please show me how to" is only rarely retrieved from the clipboard at all, and sometimes it works for the HTML case, sometimes for the text case...



      • The original bug report was that copy-pasting a large HTML table from Firefox into LibreOffice Calc doesn't reliably work when the kde5 integration is used (which uses Qt), s. https://bugs.documentfoundation.org/show_bug.cgi?id=123115 . Pasting works just fine when using gtk3 instead..
      • The issue can be reproduced on both, X11 and Wayland.
      • During a quick analysis (using 'rr' to be able to reliably replay a scenario where the issue occurs), it seemed to me that the issue is inside 'QXcbClipboard' (which is currently also used on Wayland).


        1. main.cpp
          0.7 kB
        2. output_clipboard_test.txt
          4.14 MB
        3. QTBUG-74330.tar.gz
          0.0 kB
        4. sample_output_2.txt
          3 kB
        5. tdf123115.html
          373 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.



            paeglis Gatis Paeglis
            michaelweghorn Michael Weghorn
            0 Vote for this issue
            5 Start watching this issue



                Gerrit Reviews

                There are no open Gerrit changes