XCB: Fix race with the event thread
The XCB backend runs a thread which gets events out of the XCB event queue and feeds it to the main thread via another queue. This queue is protected by a mutex. However, when the event thread exits, it cleans up after itself and frees all remaining entries in the queue. This code messed with the event queue without acquiring the needed mutex and left behind a list full of stale pointers. Fix this and protect the freeing with the correct mutex and clear the event queue afterwards. Change-Id: Ie49cf6241b76be86d8cebbc931f7226a3f6a14e5 Signed-off-by: Uli Schlachter <psychon@znc.in> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
This commit is contained in:
parent
d593d6955c
commit
bd00b51c47
@ -989,8 +989,11 @@ void QXcbEventReader::run()
|
||||
emit eventPending();
|
||||
}
|
||||
|
||||
m_mutex.lock();
|
||||
for (int i = 0; i < m_events.size(); ++i)
|
||||
free(m_events.at(i));
|
||||
m_events.clear();
|
||||
m_mutex.unlock();
|
||||
}
|
||||
|
||||
void QXcbEventReader::addEvent(xcb_generic_event_t *event)
|
||||
|
Loading…
x
Reference in New Issue
Block a user