summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2011-10-07 20:21:41 +0200
committerQt by Nokia <qt-info@nokia.com>2011-10-07 22:25:33 +0200
commitc5006a6fe23195a977bfd84c61d715e0b19850a7 (patch)
treeba6a03c81cb0052a0122772f0f2809788d6511b6 /src/plugins
parentc66b7cf55b6913dcf33d49d4f6bf9db51ccf39a8 (diff)
Fixed potential issue in XCB plugin.
Use the actual atom instead of the enum value of the atom when signaling that the event loop should exit. Change-Id: Ib98c6a46cadcecc727b28411b4c0c12c434ea828 Reviewed-on: http://codereview.qt-project.org/6265 Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.cpp14
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.h5
2 files changed, 10 insertions, 9 deletions
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp
index e90d74caa2..3d1a145442 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection.cpp
@@ -117,7 +117,7 @@ QXcbConnection::QXcbConnection(const char *displayName)
if (m_connection)
qDebug("Successfully connected to display %s", m_displayName.constData());
- m_reader = new QXcbEventReader(m_connection);
+ m_reader = new QXcbEventReader(this);
#ifdef XCB_POLL_FOR_QUEUED_EVENT
connect(m_reader, SIGNAL(eventPending()), this, SLOT(processXcbEvents()), Qt::QueuedConnection);
m_reader->start();
@@ -559,10 +559,10 @@ void QXcbConnection::addPeekFunc(PeekFunc f)
void QXcbEventReader::run()
{
xcb_generic_event_t *event;
- while (m_connection && (event = xcb_wait_for_event(m_connection))) {
+ while (m_connection && (event = xcb_wait_for_event(m_connection->xcb_connection()))) {
m_mutex.lock();
addEvent(event);
- while (m_connection && (event = xcb_poll_for_queued_event(m_connection)))
+ while (m_connection && (event = xcb_poll_for_queued_event(m_connection->xcb_connection())))
addEvent(event);
m_mutex.unlock();
emit eventPending();
@@ -576,7 +576,7 @@ void QXcbEventReader::run()
void QXcbEventReader::addEvent(xcb_generic_event_t *event)
{
if ((event->response_type & ~0x80) == XCB_CLIENT_MESSAGE
- && ((xcb_client_message_event_t *)event)->type == QXcbAtom::_QT_CLOSE_CONNECTION)
+ && ((xcb_client_message_event_t *)event)->type == m_connection->atom(QXcbAtom::_QT_CLOSE_CONNECTION))
m_connection = 0;
m_events << event;
}
@@ -585,7 +585,7 @@ QList<xcb_generic_event_t *> *QXcbEventReader::lock()
{
m_mutex.lock();
#ifndef XCB_POLL_FOR_QUEUED_EVENT
- while (xcb_generic_event_t *event = xcb_poll_for_event(m_connection))
+ while (xcb_generic_event_t *event = xcb_poll_for_event(m_connection->xcb_connection()))
m_events << event;
#endif
return &m_events;
@@ -596,7 +596,7 @@ void QXcbEventReader::unlock()
m_mutex.unlock();
}
-void QXcbConnection::sendConnectionEvent(QXcbAtom::Atom atom, uint id)
+void QXcbConnection::sendConnectionEvent(QXcbAtom::Atom a, uint id)
{
xcb_client_message_event_t event;
memset(&event, 0, sizeof(event));
@@ -605,7 +605,7 @@ void QXcbConnection::sendConnectionEvent(QXcbAtom::Atom atom, uint id)
event.format = 32;
event.sequence = 0;
event.window = m_connectionEventListener;
- event.type = atom;
+ event.type = atom(a);
event.data.data32[0] = id;
Q_XCB_CALL(xcb_send_event(xcb_connection(), false, m_connectionEventListener, XCB_EVENT_MASK_NO_EVENT, (const char *)&event));
diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h
index eb95326535..769b2e79f8 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.h
+++ b/src/plugins/platforms/xcb/qxcbconnection.h
@@ -229,11 +229,12 @@ namespace QXcbAtom {
};
}
+class QXcbConnection;
class QXcbEventReader : public QThread
{
Q_OBJECT
public:
- QXcbEventReader(xcb_connection_t *connection)
+ QXcbEventReader(QXcbConnection *connection)
: m_connection(connection)
{
}
@@ -253,7 +254,7 @@ private:
QMutex m_mutex;
QList<xcb_generic_event_t *> m_events;
- xcb_connection_t *m_connection;
+ QXcbConnection *m_connection;
};
class QAbstractEventDispatcher;