summaryrefslogtreecommitdiff
path: root/plugingui/nativewindow_x11.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2017-07-14 20:11:06 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2017-07-14 20:11:06 +0200
commite248432d2a100804aa6e769a55055d3a5fcb6307 (patch)
treefb75cea0e6136eed393a5052ac52ddc3aa2155c6 /plugingui/nativewindow_x11.cc
parente3e60b52b4e6ea35f60eb745cae2d2b1ad236874 (diff)
Fix X11 BadValue crash bug.
Diffstat (limited to 'plugingui/nativewindow_x11.cc')
-rw-r--r--plugingui/nativewindow_x11.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/plugingui/nativewindow_x11.cc b/plugingui/nativewindow_x11.cc
index bc9091d..70053ca 100644
--- a/plugingui/nativewindow_x11.cc
+++ b/plugingui/nativewindow_x11.cc
@@ -249,6 +249,17 @@ void NativeWindowX11::redraw(const Rect& dirty_rect)
auto x2 = dirty_rect.x2;
auto y2 = dirty_rect.y2;
+ // Make sure we don't try to paint a rect backwards.
+ if(x1 > x2)
+ {
+ std::swap(x1, x2);
+ }
+
+ if(y1 > y2)
+ {
+ std::swap(y1, y2);
+ }
+
updateImageFromBuffer(x1, y1, x2, y2);
XShmPutImage(display, xwindow, gc, image, x1, y1, x1, y1,