From a5e4cb8465cb3d28cda461a2613392afbf6a35a36f38929ef6cf7238760fe168 Mon Sep 17 00:00:00 2001 From: Stephan Kulow Date: Wed, 1 Oct 2014 09:22:03 +0000 Subject: [PATCH] Accepting request 251982 from KDE:Qt5 1 OBS-URL: https://build.opensuse.org/request/show/251982 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libqt5-qtbase?expand=0&rev=29 --- ...hm-if-display-name-doesnt-look-local.patch | 39 +++++++++++++++++++ libqt5-qtbase.changes | 9 +++++ libqt5-qtbase.spec | 3 ++ 3 files changed, 51 insertions(+) create mode 100644 libqt5-do-not-use-shm-if-display-name-doesnt-look-local.patch diff --git a/libqt5-do-not-use-shm-if-display-name-doesnt-look-local.patch b/libqt5-do-not-use-shm-if-display-name-doesnt-look-local.patch new file mode 100644 index 0000000..7dd9c7b --- /dev/null +++ b/libqt5-do-not-use-shm-if-display-name-doesnt-look-local.patch @@ -0,0 +1,39 @@ +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 +diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.cpp b/src/plugins/platforms/xcb/qxcbbackingstore.cpp +index dc677cd..4cd249e 100644 +--- a/src/plugins/platforms/xcb/qxcbbackingstore.cpp ++++ b/src/plugins/platforms/xcb/qxcbbackingstore.cpp +@@ -117,7 +117,8 @@ QXcbShmImage::QXcbShmImage(QXcbScreen *screen, const QSize &size, uint depth, QI + 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)); +diff --git a/src/plugins/platforms/xcb/qxcbobject.h b/src/plugins/platforms/xcb/qxcbobject.h +index 354984c..2ecb5e7 100644 +--- a/src/plugins/platforms/xcb/qxcbobject.h ++++ b/src/plugins/platforms/xcb/qxcbobject.h +@@ -56,6 +56,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; diff --git a/libqt5-qtbase.changes b/libqt5-qtbase.changes index 73f70a8..aed2e3d 100644 --- a/libqt5-qtbase.changes +++ b/libqt5-qtbase.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Wed Sep 24 16:23:20 UTC 2014 - mlin@suse.com + +- Add libqt5-do-not-use-shm-if-display-name-doesnt-look-local.patch + from Michal Srb, bnc#888858 + * additional check the display name before use SHM, this patch is + equivalent to what has been did in Qt4: + https://qt.gitorious.org/qt/qt/source/6a7f06d70e1267d3d995a3c863ba8f748d45e531:src/gui/kernel/qapplication_x11.cpp#L1986 + ------------------------------------------------------------------- Mon Sep 22 17:36:17 UTC 2014 - hrvoje.senjan@gmail.com diff --git a/libqt5-qtbase.spec b/libqt5-qtbase.spec index d0dcf76..c0d2bc0 100644 --- a/libqt5-qtbase.spec +++ b/libqt5-qtbase.spec @@ -46,6 +46,8 @@ Patch2: use-freetype-default.patch Patch3: libqt5-Fix-Gujarati-font.patch # PATCH-FIX-UPSTREAM protect-geometry-QTBUG-40584.patch -- https://bugreports.qt-project.org/browse/QTBUG-40584 Patch4: protect-geometry-QTBUG-40584.patch +# Patch-FIX-SUSE libqt5-do-not-use-shm-if-display-name-doesnt-look-local.patch -- bnc#888858 +Patch5: libqt5-do-not-use-shm-if-display-name-doesnt-look-local.patch # patches 1000-2000 and above from upstream 5.3 branch # # patches 2000-3000 and above from upstream 5.4 branch # # PATCH-FIX-UPSTREAM f1ee10f81ac18789e9a7dc715b464415ba2bc2b8.patch -- prefer QPA implementation in qsystemtrayicon_x11 if available @@ -141,6 +143,7 @@ handling. %patch2 -p1 %patch3 -p1 %patch4 -p1 +%patch5 -p1 %patch2000 -p1 %patch2001 -p1 %patch2002 -p1