From c1c2bb91dc843527e98e607811eaf2d2e46a3cbd Mon Sep 17 00:00:00 2001 From: William Kendrick Date: Tue, 25 Sep 2007 16:45:22 +0000 Subject: [PATCH] Prevented crash when clicking 'Open' or 'Erase' button in Open dialog after clicking an empty file slot. (SourceForge Bug #1787005) [Thanks to Tomasz Gloc for reporting and investigating this one.] --- docs/CHANGES.txt | 9 +++++++-- src/tuxpaint.c | 6 +++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/docs/CHANGES.txt b/docs/CHANGES.txt index 09895d5f0..094503a48 100644 --- a/docs/CHANGES.txt +++ b/docs/CHANGES.txt @@ -9,7 +9,7 @@ http://www.tuxpaint.org/ $Id$ -2007.September.8 (0.9.18) +2007.September.25 (0.9.18) * Interface Improvements: ----------------------- * Improved 'New' and 'Open' interface: @@ -35,7 +35,7 @@ $Id$ Use "_flip.png"/"_flip.svg" and "_mirror_flip.png"/"_mirror_flip.png", respectively. - * Documentation Imrpovements: + * Documentation Improvements: --------------------------- * Improved --usage output. @@ -225,6 +225,11 @@ $Id$ it looks OK. I'm hoping it is a driver problem on my system.) John Popplewell + * Prevented crash when clicking 'Open' or 'Erase' button in Open dialog + after clicking an empty file slot. + (SourceForge Bug #1787005) + Thanks to Tomasz Gloc for reporting and investigating this one. + 2007.July.1 (0.9.17) diff --git a/src/tuxpaint.c b/src/tuxpaint.c index d78d9736a..0c409dbac 100644 --- a/src/tuxpaint.c +++ b/src/tuxpaint.c @@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA (See COPYING.txt) - June 14, 2002 - August 9, 2007 + June 14, 2002 - September 25, 2007 $Id$ */ @@ -13211,6 +13211,8 @@ int do_open(void) { /* Picked an icon! */ + int old_which = which; + which = ((event.button.x - 96) / (THUMB_W) + (((event.button.y - 24) / THUMB_H) * 4)) + cur; @@ -13233,6 +13235,8 @@ int do_open(void) last_click_time = SDL_GetTicks(); last_click_button = event.button.button; } + else + which = old_which; } else if (event.button.x >= (WINDOW_WIDTH - img_scroll_up->w) / 2 && event.button.x <= (WINDOW_WIDTH + img_scroll_up->w) / 2)