libqt5-qtbase/libqt5-do-not-use-shm-if-display-name-doesnt-look-local.patch
Dominique Leuenberger 82c1b4e916 Accepting request 508314 from KDE:Qt5
- Recommend libqt5-qttranslations in libQt5Core5 (boo#1027925)

- Fix typo in description (boo#1043338)

- Update to 5.9.1
  * For more details please see:
    http://blog.qt.io/blog/2017/06/30/qt-5-9-1-released/
- Drop upstreamed patches:
  - fix-cmake-module-version.patch
  - dont-destroy-foreign-windows.patch
  - native-children-hidpi-offset.patch
- Force use of libproxy, that switch got lost apparently
- Add patch to allow build with at-spi2: 0001-Fix-at-spi2-build.patch

OBS-URL: https://build.opensuse.org/request/show/508314
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libqt5-qtbase?expand=0&rev=61
2017-07-08 10:25:20 +00:00

40 lines
2.2 KiB
Diff

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>
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
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));
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:
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;