diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2017-07-15 10:15:21 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2017-07-15 10:15:21 +0200 |
commit | f777a1a3f5f92814f8b83fe0c22dbe461f11bed7 (patch) | |
tree | 27ac8e3f573f01d51f5e034f4a90a24f92d02956 /plugingui/window.cc | |
parent | e248432d2a100804aa6e769a55055d3a5fcb6307 (diff) |
Better fix X11 BadValue crash bug which also prevents similar issues on non-X11 platforms.
Diffstat (limited to 'plugingui/window.cc')
-rw-r--r-- | plugingui/window.cc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/plugingui/window.cc b/plugingui/window.cc index 099cb91..60ecf02 100644 --- a/plugingui/window.cc +++ b/plugingui/window.cc @@ -358,6 +358,17 @@ bool Window::updateBuffer() dirty_rect.x2 = std::min(wpixbuf.width, dirty_rect.x2); dirty_rect.y2 = std::min(wpixbuf.height, dirty_rect.y2); + // Make sure we don't try to paint a rect backwards. + if(dirty_rect.x1 > dirty_rect.x2) + { + std::swap(dirty_rect.x1, dirty_rect.x2); + } + + if(dirty_rect.y1 > dirty_rect.y2) + { + std::swap(dirty_rect.y1, dirty_rect.y2); + } + native->redraw(dirty_rect); needs_redraw = false; |