Stephan Kulow 2014-10-01 09:22:03 +00:00 committed by Git OBS Bridge
parent 8335382250
commit a5e4cb8465
3 changed files with 51 additions and 0 deletions

View File

@ -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 <msrb@suse.com>
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;

View File

@ -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

View File

@ -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