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/nativewindow_x11.cc | |
parent | e248432d2a100804aa6e769a55055d3a5fcb6307 (diff) |
Better fix X11 BadValue crash bug which also prevents similar issues on non-X11 platforms.
Diffstat (limited to 'plugingui/nativewindow_x11.cc')
-rw-r--r-- | plugingui/nativewindow_x11.cc | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/plugingui/nativewindow_x11.cc b/plugingui/nativewindow_x11.cc index 70053ca..5faecc1 100644 --- a/plugingui/nativewindow_x11.cc +++ b/plugingui/nativewindow_x11.cc @@ -33,8 +33,8 @@ #include <sys/shm.h> #include <cerrno> #include <cstring> +#include <cassert> -#include <stdlib.h> #include <chrono> #include <hugin.hpp> @@ -249,16 +249,9 @@ 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); - } + // Assert that we don't try to paint a backwards rect. + assert(x1 <= x2); + assert(y1 <= y2); updateImageFromBuffer(x1, y1, x2, y2); |