From f7ebb8d4c64030a0569f8f2af98dad665a6866a7 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Tue, 20 Aug 2013 11:41:15 +0200 Subject: QXcbBackingStore: don't crash in flush() if no platformWindow Task-number: QTBUG-32681 Change-Id: Iec7204985867a8d65cea393ba6ab66d328a5e7b2 Reviewed-by: Friedemann Kleint --- src/plugins/platforms/xcb/qxcbbackingstore.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/plugins/platforms/xcb') diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.cpp b/src/plugins/platforms/xcb/qxcbbackingstore.cpp index 1f2485db0d..dc677cd3be 100644 --- a/src/plugins/platforms/xcb/qxcbbackingstore.cpp +++ b/src/plugins/platforms/xcb/qxcbbackingstore.cpp @@ -306,6 +306,10 @@ void QXcbBackingStore::flush(QWindow *window, const QRegion ®ion, const QPoin Q_XCB_NOOP(connection()); QXcbWindow *platformWindow = static_cast(window->handle()); + if (!platformWindow) { + qWarning("QXcbBackingStore::flush: QWindow has no platform window (QTBUG-32681)"); + return; + } QVector rects = clipped.rects(); for (int i = 0; i < rects.size(); ++i) -- cgit v1.2.3 From bd00b51c47f986dd2f8b7696b09f10f19321a99e Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Thu, 22 Aug 2013 14:31:10 +0200 Subject: 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 Reviewed-by: Friedemann Kleint Reviewed-by: Shawn Rutledge --- src/plugins/platforms/xcb/qxcbconnection.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/plugins/platforms/xcb') diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 01af23377e..2ce34ea8f2 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -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) -- cgit v1.2.3