summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@theqtcompany.com>2015-11-23 11:57:58 +0100
committerUlf Hermann <ulf.hermann@theqtcompany.com>2015-12-10 10:28:56 +0000
commit1f2734b82b77fc8a959fdca8f3372cf09f65edd8 (patch)
tree489783aeee5f9ab405b1f43cff364e31456504f2 /src/plugins
parent4c29eba2484319541e0b2863b0dc1e7081228ec2 (diff)
Xcb: Fix debugging code
We need to pass the correct connection and we need a specialization for reply pointers. Also, there is not much of a point in first creating a QString from a QByteArray, only to retrieve a QByteArray again. Change-Id: Ia1bb5655f6229638e3bd2339acadeffc80561b9e Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.cpp11
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.h16
-rw-r--r--src/plugins/platforms/xcb/qxcbnativeinterface.cpp14
3 files changed, 30 insertions, 11 deletions
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp
index ff39b24e93..1d20432bd4 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection.cpp
@@ -934,17 +934,20 @@ void QXcbConnection::handleXcbError(xcb_generic_error_t *error)
int i = 0;
for (; i < m_callLog.size(); ++i) {
if (m_callLog.at(i).sequence == error->sequence) {
- qDebug("Caused by: %s:%d", qPrintable(m_callLog.at(i).file), m_callLog.at(i).line);
+ qDebug("Caused by: %s:%d", m_callLog.at(i).file.constData(), m_callLog.at(i).line);
break;
} else if (m_callLog.at(i).sequence > error->sequence) {
- qDebug("Caused some time before: %s:%d", qPrintable(m_callLog.at(i).file), m_callLog.at(i).line);
+ qDebug("Caused some time before: %s:%d", m_callLog.at(i).file.constData(),
+ m_callLog.at(i).line);
if (i > 0)
- qDebug("and after: %s:%d", qPrintable(m_callLog.at(i-1).file), m_callLog.at(i-1).line);
+ qDebug("and after: %s:%d", m_callLog.at(i-1).file.constData(),
+ m_callLog.at(i-1).line);
break;
}
}
if (i == m_callLog.size() && !m_callLog.isEmpty())
- qDebug("Caused some time after: %s:%d", qPrintable(m_callLog.first().file), m_callLog.first().line);
+ qDebug("Caused some time after: %s:%d", m_callLog.first().file.constData(),
+ m_callLog.first().line);
#endif
}
diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h
index 3c82170679..cf50076f98 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.h
+++ b/src/plugins/platforms/xcb/qxcbconnection.h
@@ -626,7 +626,11 @@ private:
QMutex m_callLogMutex;
void log(const char *file, int line, int sequence);
template <typename cookie_t>
- friend cookie_t q_xcb_call_template(const cookie_t &cookie, QXcbConnection *connection, const char *file, int line);
+ friend cookie_t q_xcb_call_template(const cookie_t &cookie, QXcbConnection *connection,
+ const char *file, int line);
+ template <typename reply_t>
+ friend reply_t *q_xcb_call_template(reply_t *reply, QXcbConnection *connection,
+ const char *file, int line);
#endif
WindowMapper m_mapper;
@@ -689,11 +693,19 @@ private:
#ifdef Q_XCB_DEBUG
template <typename cookie_t>
-cookie_t q_xcb_call_template(const cookie_t &cookie, QXcbConnection *connection, const char *file, int line)
+cookie_t q_xcb_call_template(const cookie_t &cookie, QXcbConnection *connection, const char *file,
+ int line)
{
connection->log(file, line, cookie.sequence);
return cookie;
}
+
+template <typename reply_t>
+reply_t *q_xcb_call_template(reply_t *reply, QXcbConnection *connection, const char *file, int line)
+{
+ connection->log(file, line, reply->sequence);
+ return reply;
+}
#define Q_XCB_CALL(x) q_xcb_call_template(x, connection(), __FILE__, __LINE__)
#define Q_XCB_CALL2(x, connection) q_xcb_call_template(x, connection, __FILE__, __LINE__)
#define Q_XCB_NOOP(c) q_xcb_call_template(xcb_no_operation(c->xcb_connection()), c, __FILE__, __LINE__);
diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
index dfb0a125e2..374eaa4d6e 100644
--- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
+++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
@@ -444,11 +444,15 @@ void *QXcbNativeInterface::atspiBus()
QXcbConnection *defaultConnection = integration->defaultConnection();
if (defaultConnection) {
xcb_atom_t atspiBusAtom = defaultConnection->internAtom("AT_SPI_BUS");
- xcb_get_property_cookie_t cookie = Q_XCB_CALL(xcb_get_property(defaultConnection->xcb_connection(), false,
- defaultConnection->rootWindow(),
- atspiBusAtom,
- XCB_ATOM_STRING, 0, 128));
- xcb_get_property_reply_t *reply = Q_XCB_CALL(xcb_get_property_reply(defaultConnection->xcb_connection(), cookie, 0));
+ xcb_get_property_cookie_t cookie = Q_XCB_CALL2(xcb_get_property(
+ defaultConnection->xcb_connection(),
+ false, defaultConnection->rootWindow(),
+ atspiBusAtom, XCB_ATOM_STRING, 0, 128),
+ defaultConnection);
+ xcb_get_property_reply_t *reply = Q_XCB_CALL2(xcb_get_property_reply(
+ defaultConnection->xcb_connection(),
+ cookie, 0),
+ defaultConnection);
Q_ASSERT(!reply->bytes_after);
char *data = (char *)xcb_get_property_value(reply);
int length = xcb_get_property_value_length(reply);