diff options
author | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2009-09-18 09:17:12 (GMT) |
---|---|---|
committer | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2009-09-18 12:54:52 (GMT) |
commit | 99005e254b6055e63fc432efd38b9a5a2d0ffcc9 (patch) | |
tree | 17246394cdb5bfb1c72f08db183480780617ad64 /src | |
parent | a6d34dc0c8715c461fa47da76f5615df60f7b61a (diff) | |
download | Qt-99005e254b6055e63fc432efd38b9a5a2d0ffcc9.zip Qt-99005e254b6055e63fc432efd38b9a5a2d0ffcc9.tar.gz Qt-99005e254b6055e63fc432efd38b9a5a2d0ffcc9.tar.bz2 |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/painting/qwindowsurface_x11.cpp | 13 |
1 files 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) |