[Interest] XCB clipboard freeze

Benjamin TERRIER b.terrier at gmail.com
Mon Nov 4 15:06:34 CET 2019


Hi,

I have stumble upon a clipboard issue.

I am working on a project wher we use Qt and CEF (Chromium Embedded).
The CEF event loop is integrated in Qt by calling CefDoMessageLoopWork()
periodically
from Qt main event loop.

The issue arises when we copy/paste content from CEF into Qt (widget or qt
quick item): all the UI freezes for several seconds and at the end nothing
is pasted.

I have been able to locate the issue in
QXcbClipboard::waitForClipboardEvent() and
QXcbEventQueue::waitForNewEvents() where Qt waits to receive the clipboard
content without running the event loop.
Also it seems that CEF needs to have CefDoMessageLoopWork() called to
process the clipboard event on its side.
In the end, we end up with a deadlock where Qt is waiting for CEF to send
the clipboard content, but CEF is waiting for Qt to run
CefDoMessageLoopWork().

I was able to make it work by using QClipboard from another thread and it
works.
But I am not sure it is safe to interact with the clipboard from a non UI
thread and anyway this solution is not applicable all the clipboard
interactions already handled by Qt.

Has anyone ever encountered this kind of issue?

Is it intended that Qt stops processing event while waiting for the
clipboard?

Regards,


Benjamin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20191104/442c8782/attachment.html>


More information about the Interest mailing list