diff --git a/src/gtk/region.cpp b/src/gtk/region.cpp index e1394a48b4..7ca7653e2a 100644 --- a/src/gtk/region.cpp +++ b/src/gtk/region.cpp @@ -185,6 +185,12 @@ void wxRegion::Clear() bool wxRegion::Union( wxCoord x, wxCoord y, wxCoord width, wxCoord height ) { + // workaround for a strange GTK/X11 bug: taking union with an empty + // rectangle results in an empty region which is definitely not what we + // want + if ( !width || !height ) + return TRUE; + GdkRectangle rect; rect.x = x; rect.y = y; diff --git a/src/gtk1/region.cpp b/src/gtk1/region.cpp index e1394a48b4..7ca7653e2a 100644 --- a/src/gtk1/region.cpp +++ b/src/gtk1/region.cpp @@ -185,6 +185,12 @@ void wxRegion::Clear() bool wxRegion::Union( wxCoord x, wxCoord y, wxCoord width, wxCoord height ) { + // workaround for a strange GTK/X11 bug: taking union with an empty + // rectangle results in an empty region which is definitely not what we + // want + if ( !width || !height ) + return TRUE; + GdkRectangle rect; rect.x = x; rect.y = y;