From 99005e254b6055e63fc432efd38b9a5a2d0ffcc9 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Fri, 18 Sep 2009 11:17:12 +0200 Subject: Fixed passing a zero drawable to X11 api causing X errors. In the windowsurface we shouldn't create a backingstore pixmap if the window has invalid size. Reviewed-by: Samuel --- src/gui/painting/qwindowsurface_x11.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/gui/painting/qwindowsurface_x11.cpp b/src/gui/painting/qwindowsurface_x11.cpp index ffd6f17..5e4433c 100644 --- a/src/gui/painting/qwindowsurface_x11.cpp +++ b/src/gui/painting/qwindowsurface_x11.cpp @@ -139,7 +139,8 @@ void QX11WindowSurface::setGeometry(const QRect &rect) QWindowSurface::setGeometry(rect); const QSize size = rect.size(); - if (d_ptr->device.size() == size) + + if (d_ptr->device.size() == size || size.width() <= 0 || size.height() <= 0) return; #ifndef QT_NO_XRENDER if (d_ptr->translucentBackground) { @@ -183,10 +184,14 @@ void QX11WindowSurface::setGeometry(const QRect &rect) } } - if (gc) + if (gc) { XFreeGC(X11->display, gc); - gc = XCreateGC(X11->display, d_ptr->device.handle(), 0, 0); - XSetGraphicsExposures(X11->display, gc, False); + gc = 0; + } + if (!d_ptr->device.isNull()) { + gc = XCreateGC(X11->display, d_ptr->device.handle(), 0, 0); + XSetGraphicsExposures(X11->display, gc, False); + } } bool QX11WindowSurface::scroll(const QRegion &area, int dx, int dy) -- cgit v0.12