From f8fe5eeea0376e5f1cba12fdef87fa687db34885 Mon Sep 17 00:00:00 2001 From: John Popplewell Date: Tue, 25 Dec 2007 00:22:02 +0000 Subject: [PATCH] Fix bug in special_notify(). Reproducable crash on win32 after exactly 40 flips or mirrors. Was (probably) corrupting an element in SDL_Surface *undo_bufs[]. --- src/tuxpaint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tuxpaint.c b/src/tuxpaint.c index 7ff70a44c..3cb5c6187 100644 --- a/src/tuxpaint.c +++ b/src/tuxpaint.c @@ -17019,7 +17019,8 @@ void special_notify(int flags) { int tmp_int; - tmp_int = (cur_undo - 1) % NUM_UNDO_BUFS; + tmp_int = cur_undo - 1; + if (tmp_int < 0) tmp_int = NUM_UNDO_BUFS - 1; if (flags & SPECIAL_MIRROR) {