Discussion:
"QXcbClipboard::setMimeData: Cannot set X11 selection owner"
(too old to reply)
René J.V. Bertin
2018-03-07 11:21:45 UTC
Permalink
Raw Message
Hi,

Apologies if I've asked this before: any idea what could cause this error message?

QXcbClipboard::setMimeData: Cannot set X11 selection owner

I'm seeing this sporadically in applications connected to an XQuartz X11 server that has been running for a certain time. It always seem to affect all the applications that are currently connected, but doesn't persist after an application restart (= I don't have to restart the server).

Hoping for some insight(s); I'm pretty certain that the issue is caused by something odd in XQuartz but cannot ignore the fact that it affects only Qt applications (GTk-based applications are not affected).

Thanks,
René
Thiago Macieira
2018-03-07 14:52:32 UTC
Permalink
Raw Message
Post by René J.V. Bertin
QXcbClipboard::setMimeData: Cannot set X11 selection owner
I'm seeing this sporadically in applications connected to an XQuartz X11
server that has been running for a certain time. It always seem to affect
all the applications that are currently connected, but doesn't persist
after an application restart (= I don't have to restart the server).
Hoping for some insight(s); I'm pretty certain that the issue is caused by
something odd in XQuartz but cannot ignore the fact that it affects only Qt
applications (GTk-based applications are not affected).
Obviously no GTK application is going to print something about
"QXcbClipboard". Can you see any other symptom besides the warning?
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
René J. V. Bertin
2018-03-07 15:36:43 UTC
Permalink
Raw Message
Post by Thiago Macieira
Obviously no GTK application is going to print something about
"QXcbClipboard".
Yeah, DOH :) I don't have the GTk sources on my system currently but it's likely
that somewhere there will be a call to xcb_set_selection_owner() in there too,
no? That's where the error message I see comes from: the call fails (doesn't
have the expected effect).
Post by Thiago Macieira
Can you see any other symptom besides the warning?
Sadly, yes. Copying to the clipboard no longer works in affected applications.
Instead I get that error message.

Fortunately this doesn't happen often, but that's also annoying for debugging.
I'm now dumping the immediately relevant variables when the error does occur,
and also use xcb_set_selection_owner_checked() and xcb_request_check() in hope
that will tell us what really goes wrong.

R.
Thiago Macieira
2018-03-07 18:53:23 UTC
Permalink
Raw Message
Post by René J. V. Bertin
Post by Thiago Macieira
Obviously no GTK application is going to print something about
"QXcbClipboard".
Yeah, DOH :) I don't have the GTk sources on my system currently but it's
likely that somewhere there will be a call to xcb_set_selection_owner() in
there too, no? That's where the error message I see comes from: the call
fails (doesn't have the expected effect).
Yes, it's likely. That doesn't mean GTK prints something as a result of that.
Post by René J. V. Bertin
Post by Thiago Macieira
Can you see any other symptom besides the warning?
Sadly, yes. Copying to the clipboard no longer works in affected
applications. Instead I get that error message.
And this symptom doesn't happen with GTK?
Post by René J. V. Bertin
Fortunately this doesn't happen often, but that's also annoying for
debugging. I'm now dumping the immediately relevant variables when the
error does occur, and also use xcb_set_selection_owner_checked() and
xcb_request_check() in hope that will tell us what really goes wrong.
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
René J. V. Bertin
2018-03-07 21:32:24 UTC
Permalink
Raw Message
Post by Thiago Macieira
Yes, it's likely. That doesn't mean GTK prints something as a result of that.
No, but I don't care about the error message in itself.
Post by Thiago Macieira
And this symptom doesn't happen with GTK?
And no, which is what I meant when I said that those applications aren't
affected (I use a minimal XCFE desktop, so always have a couple of GTk-based
applications running).

R.
René J. V. Bertin
2018-06-15 09:20:20 UTC
Permalink
Raw Message
Post by Thiago Macieira
Post by René J. V. Bertin
Yeah, DOH :) I don't have the GTk sources on my system currently but it's
likely that somewhere there will be a call to xcb_set_selection_owner() in
there too, no? That's where the error message I see comes from: the call
fails (doesn't have the expected effect).
Yes, it's likely. That doesn't mean GTK prints something as a result of that.
What exactly is the purpose of using the XCB selection owner functionality?
Something like "clear the clipboard when the application exits"?

I'd probably prefer not using selection ownership over the risk of no longer
being able to copy things to the clipboard. Or would a reset as performed by
QXcbClipboard::handleXFixesSelectionRequest() help here?

FWIW, I notice that GTk(3) doesn't use
xcb_xfixes_select_selection_input_checked() at all, so there's another possible
reason why GTk applications are not affected when the issue hits me.


R.
René J. V. Bertin
2018-06-15 09:29:58 UTC
Permalink
Raw Message
Post by René J. V. Bertin
FWIW, I notice that GTk(3) doesn't use
xcb_xfixes_select_selection_input_checked() at all, so there's another
possible reason why GTk applications are not affected when the issue hits me.
Or simply the fact it doesn't use xcb_set_selection_owner() at all. It does use
XFixesSelectSelectionInput() though, any difference there?
Thiago Macieira
2018-06-15 13:25:32 UTC
Permalink
Raw Message
Post by René J. V. Bertin
Post by Thiago Macieira
Post by René J. V. Bertin
Yeah, DOH :) I don't have the GTk sources on my system currently but it's
likely that somewhere there will be a call to xcb_set_selection_owner() in
there too, no? That's where the error message I see comes from: the call
fails (doesn't have the expected effect).
Yes, it's likely. That doesn't mean GTK prints something as a result of that.
What exactly is the purpose of using the XCB selection owner functionality?
To implement the clipboard and primary selection.
Post by René J. V. Bertin
Something like "clear the clipboard when the application exits"?
That's a side-effect. The purpose is to implement the clipboard in the first
place.
Post by René J. V. Bertin
I'd probably prefer not using selection ownership over the risk of no longer
being able to copy things to the clipboard. Or would a reset as performed
by QXcbClipboard::handleXFixesSelectionRequest() help here?
There's nothing to be changed, unless you want to disable clipboard support
completely.
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
René J. V. Bertin
2018-06-15 16:57:21 UTC
Permalink
Raw Message
Post by Thiago Macieira
There's nothing to be changed, unless you want to disable clipboard support
completely.
I'm guessing I could implement a fallback to XStoreBuffer, so that at least text
copying works?
Heck, since this is on Mac I could even pipe text content into pbcopy...

Now, would it be possible that selection owner setting fails because
QXcbConnection::getQtSelectionOwner() returns something that has gone invalid?
Or rather, because the xcb_window created by that function has been closed
somehow? If so, would forcing a reset of m_qtSelectionOwner be a way out of the
issue?

R

René J. V. Bertin
2018-06-14 20:57:35 UTC
Permalink
Raw Message
it took a while, but I just got bitten by this again. The diagnostics output I
added shows this:

QXcbClipboard::setMimeData: Cannot set X11 selection owner
clipboard mode= 0 connection= 0x7fcdab809000 time= 4293362843 newOwner=
20971523 effective owner: 4194305

Any idea what to make of that?

R.
Loading...