diff options
author | Samuel Rødal <samuel.rodal@nokia.com> | 2011-09-12 10:43:13 +0200 |
---|---|---|
committer | Gunnar Sletta <gunnar.sletta@nokia.com> | 2011-09-12 12:57:30 +0200 |
commit | 2ce969d7f00483991e9727c201dc3144b6efa281 (patch) | |
tree | 51af7ddaecc8b12691fc6187c18ccc208c61a5a5 /src/plugins/platforms/xcb | |
parent | f48b526c3da293866422623d8c30d85fd1da49ed (diff) |
Fixed race condition in xcb plugin logging (when debugging is enabled).
Change-Id: I8fa11ba26037d8f78e7c5131326d94836d0de9d4
Reviewed-on: http://codereview.qt-project.org/4647
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
Diffstat (limited to 'src/plugins/platforms/xcb')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbconnection.cpp | 3 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbconnection.h | 1 |
2 files changed, 4 insertions, 0 deletions
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index a8ffc5832a..a0b894602d 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -419,6 +419,7 @@ const char *xcb_protocol_request_codes[] = #ifdef Q_XCB_DEBUG void QXcbConnection::log(const char *file, int line, int sequence) { + QMutexLocker locker(&m_callLogMutex); CallInfo info; info.sequence = sequence; info.file = file; @@ -438,6 +439,7 @@ void QXcbConnection::handleXcbError(xcb_generic_error_t *error) int(error->major_code), xcb_protocol_request_codes[clamped_major_code], int(error->minor_code)); #ifdef Q_XCB_DEBUG + QMutexLocker locker(&m_callLogMutex); int i = 0; for (; i < m_callLog.size(); ++i) { if (m_callLog.at(i).sequence == error->sequence) { @@ -459,6 +461,7 @@ void QXcbConnection::handleXcbEvent(xcb_generic_event_t *event) { #ifdef Q_XCB_DEBUG { + QMutexLocker locker(&m_callLogMutex); int i = 0; for (; i < m_callLog.size(); ++i) if (m_callLog.at(i).sequence >= event->sequence) diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 8c05fe23e4..6d93093072 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -375,6 +375,7 @@ private: int line; }; QVector<CallInfo> m_callLog; + 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); |