xcb: Check for SYNC extension before using it

If we call any xcb_sync_*() function, libxcb will have to figure out
SYNC's major number. However, if that fails because the SYNC extension
is not available, xcb will disconnect from the server. Obviously,
that's not what we want and must be avoided.

Change-Id: I9a1032e1cfac074a52bafcb0772304bfd423e770
Signed-off-by: Uli Schlachter <psychon@znc.in>
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
bb10
Uli Schlachter 2012-01-28 22:47:30 +01:00 committed by Qt by Nokia
parent 6466314625
commit 98d34beb03
1 changed files with 5 additions and 1 deletions

View File

@ -108,7 +108,11 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *screen, int num
free(reply);
m_syncRequestSupported = m_windowManagerName != QLatin1String("KWin");
const xcb_query_extension_reply_t *sync_reply = xcb_get_extension_data(xcb_connection(), &xcb_sync_id);
if (!sync_reply || !sync_reply->present)
m_syncRequestSupported = false;
else
m_syncRequestSupported = m_windowManagerName != QLatin1String("KWin");
m_clientLeader = xcb_generate_id(xcb_connection());
Q_XCB_CALL2(xcb_create_window(xcb_connection(),