2014-10-01 11:22:03 +02:00
|
|
|
Do not use SHM if display name doesn't look local.
|
|
|
|
|
|
|
|
Verifying availability of SHM only by using response of SHM Attach is not
|
|
|
|
reliable. There is always small chance that when we are a remote client of X
|
|
|
|
server, we'll get shmid that is already in use by some local X client. In that
|
|
|
|
case X server can not recognize that it is not accessing our shared memory but
|
|
|
|
the one of the other client and will report success.
|
|
|
|
|
|
|
|
This adds check for display name equivalent to one that was in Qt4. Determining
|
|
|
|
whether the connection is local/remote from display name is not 100% reliable,
|
|
|
|
but worked fine for years in Qt4.
|
|
|
|
|
|
|
|
Signed-off-by: Michal Srb <msrb@suse.com>
|
2017-07-08 12:25:20 +02:00
|
|
|
Index: qtbase-opensource-src-5.9.1/src/plugins/platforms/xcb/qxcbbackingstore.cpp
|
|
|
|
===================================================================
|
|
|
|
--- qtbase-opensource-src-5.9.1.orig/src/plugins/platforms/xcb/qxcbbackingstore.cpp
|
|
|
|
+++ qtbase-opensource-src-5.9.1/src/plugins/platforms/xcb/qxcbbackingstore.cpp
|
|
|
|
@@ -178,7 +178,8 @@ QXcbShmImage::QXcbShmImage(QXcbScreen *s
|
2014-10-01 11:22:03 +02:00
|
|
|
m_shm_info.shmseg = xcb_generate_id(xcb_connection());
|
|
|
|
|
|
|
|
const xcb_query_extension_reply_t *shm_reply = xcb_get_extension_data(xcb_connection(), &xcb_shm_id);
|
|
|
|
- bool shm_present = shm_reply != NULL && shm_reply->present;
|
|
|
|
+ bool is_local = (!displayName() || displayName()[0] == ':');
|
|
|
|
+ bool shm_present = is_local && shm_reply != NULL && shm_reply->present;
|
|
|
|
xcb_generic_error_t *error = NULL;
|
|
|
|
if (shm_present)
|
|
|
|
error = xcb_request_check(xcb_connection(), xcb_shm_attach_checked(xcb_connection(), m_shm_info.shmseg, m_shm_info.shmid, false));
|
2017-07-08 12:25:20 +02:00
|
|
|
Index: qtbase-opensource-src-5.9.1/src/plugins/platforms/xcb/qxcbobject.h
|
|
|
|
===================================================================
|
|
|
|
--- qtbase-opensource-src-5.9.1.orig/src/plugins/platforms/xcb/qxcbobject.h
|
|
|
|
+++ qtbase-opensource-src-5.9.1/src/plugins/platforms/xcb/qxcbobject.h
|
|
|
|
@@ -54,6 +54,7 @@ public:
|
2014-10-01 11:22:03 +02:00
|
|
|
|
|
|
|
xcb_atom_t atom(QXcbAtom::Atom atom) const { return m_connection->atom(atom); }
|
|
|
|
xcb_connection_t *xcb_connection() const { return m_connection->xcb_connection(); }
|
|
|
|
+ const char *displayName() const { return m_connection->displayName(); }
|
|
|
|
|
|
|
|
private:
|
|
|
|
QXcbConnection *m_connection;
|