xcb: Correctly check the X11 connection

Commit e08453f31a added a check which makes
sure qt prints an error message instead of segfaulting when it can't
connect to the X11 server.

However, libxcb will never return NULL from xcb_connect() and thus that
commit only works if XCB_USE_XLIB is defined and used.

Change-Id: I8cc1496494a94f07055a3ac5093ce362dd347c5b
Signed-off-by: Uli Schlachter <psychon@znc.in>
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
This commit is contained in:
Uli Schlachter 2012-01-22 21:03:12 +01:00 committed by Qt by Nokia
parent 07993161b1
commit bd2ce747fc

View File

@ -132,7 +132,7 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, const char
m_connection = xcb_connect(m_displayName.constData(), &m_primaryScreen);
#endif //XCB_USE_XLIB
if (!m_connection)
if (!m_connection || xcb_connection_has_error(m_connection))
qFatal("Could not connect to display %s", m_displayName.constData());
m_reader = new QXcbEventReader(this);