From 22a79e81758d0b6a07168ac937ad3a42db8ff21a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Wed, 6 Apr 2011 12:41:30 +0200 Subject: Prevent crashes and X errors in QXcbWindowSurface::flush() Make sure the region to flush is inside the bounds (it might be outside if the window surface hasn't been initialized yet or if a resize just happened and we get an Expose event too soon). --- src/plugins/platforms/xcb/qxcbwindowsurface.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbwindowsurface.cpp b/src/plugins/platforms/xcb/qxcbwindowsurface.cpp index a4607dc..318ac15 100644 --- a/src/plugins/platforms/xcb/qxcbwindowsurface.cpp +++ b/src/plugins/platforms/xcb/qxcbwindowsurface.cpp @@ -186,8 +186,10 @@ void QXcbWindowSurface::endPaint(const QRegion &) void QXcbWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) { - Q_UNUSED(region); - Q_UNUSED(offset); + QRect bounds = region.boundingRect(); + + if (size().isEmpty() || !geometry().contains(bounds)) + return; Q_XCB_NOOP(connection()); -- cgit v0.12