From e424354e85671928e6a1cf11cb5cf0a89ba9357f Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Mon, 24 Sep 2012 15:23:12 +0200 Subject: xcb: consistently check xcb_get_extension_data for extension inits MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This seems to fix the ability to run a Qt app across a forwarded X connection (e.g. ssh -X). Change-Id: I2b7a26985cf11107e69b303337a5fbb369e38c9e Reviewed-by: Samuel Rødal Reviewed-by: Uli Schlachter --- src/plugins/platforms/xcb/qxcbconnection.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/plugins/platforms/xcb/qxcbconnection.cpp') diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index b82a17dc05..76534cf5c4 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -1219,8 +1219,10 @@ void QXcbConnection::initializeXFixes() { xcb_generic_error_t *error = 0; const xcb_query_extension_reply_t *reply = xcb_get_extension_data(m_connection, &xcb_xfixes_id); - xfixes_first_event = reply->first_event; + if (!reply || !reply->present) + return; + xfixes_first_event = reply->first_event; xcb_xfixes_query_version_cookie_t xfixes_query_cookie = xcb_xfixes_query_version(m_connection, XCB_XFIXES_MAJOR_VERSION, XCB_XFIXES_MINOR_VERSION); @@ -1237,6 +1239,10 @@ void QXcbConnection::initializeXFixes() void QXcbConnection::initializeXRender() { #ifdef XCB_USE_RENDER + const xcb_query_extension_reply_t *reply = xcb_get_extension_data(m_connection, &xcb_render_id); + if (!reply || !reply->present) + return; + xcb_generic_error_t *error = 0; xcb_render_query_version_cookie_t xrender_query_cookie = xcb_render_query_version(m_connection, XCB_RENDER_MAJOR_VERSION, @@ -1253,11 +1259,11 @@ void QXcbConnection::initializeXRender() void QXcbConnection::initializeXRandr() { - const xcb_query_extension_reply_t *xrandr_reply = xcb_get_extension_data(m_connection, &xcb_randr_id); - if (!xrandr_reply || !xrandr_reply->present) + const xcb_query_extension_reply_t *reply = xcb_get_extension_data(m_connection, &xcb_randr_id); + if (!reply || !reply->present) return; - xrandr_first_event = xrandr_reply->first_event; + xrandr_first_event = reply->first_event; xcb_generic_error_t *error = 0; xcb_randr_query_version_cookie_t xrandr_query_cookie = xcb_randr_query_version(m_connection, -- cgit v1.2.3