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.]
This commit is contained in:
William Kendrick 2007-09-25 16:45:22 +00:00
parent 29a8206965
commit c1c2bb91dc
2 changed files with 12 additions and 3 deletions

View file

@ -9,7 +9,7 @@ http://www.tuxpaint.org/
$Id$ $Id$
2007.September.8 (0.9.18) 2007.September.25 (0.9.18)
* Interface Improvements: * Interface Improvements:
----------------------- -----------------------
* Improved 'New' and 'Open' interface: * Improved 'New' and 'Open' interface:
@ -35,7 +35,7 @@ $Id$
Use "_flip.png"/"_flip.svg" and "_mirror_flip.png"/"_mirror_flip.png", Use "_flip.png"/"_flip.svg" and "_mirror_flip.png"/"_mirror_flip.png",
respectively. respectively.
* Documentation Imrpovements: * Documentation Improvements:
--------------------------- ---------------------------
* Improved --usage output. * Improved --usage output.
@ -225,6 +225,11 @@ $Id$
it looks OK. I'm hoping it is a driver problem on my system.) it looks OK. I'm hoping it is a driver problem on my system.)
John Popplewell <john@johnnypops.demon.co.uk> John Popplewell <john@johnnypops.demon.co.uk>
* 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) 2007.July.1 (0.9.17)

View file

@ -22,7 +22,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt) (See COPYING.txt)
June 14, 2002 - August 9, 2007 June 14, 2002 - September 25, 2007
$Id$ $Id$
*/ */
@ -13211,6 +13211,8 @@ int do_open(void)
{ {
/* Picked an icon! */ /* Picked an icon! */
int old_which = which;
which = ((event.button.x - 96) / (THUMB_W) + which = ((event.button.x - 96) / (THUMB_W) +
(((event.button.y - 24) / THUMB_H) * 4)) + cur; (((event.button.y - 24) / THUMB_H) * 4)) + cur;
@ -13233,6 +13235,8 @@ int do_open(void)
last_click_time = SDL_GetTicks(); last_click_time = SDL_GetTicks();
last_click_button = event.button.button; last_click_button = event.button.button;
} }
else
which = old_which;
} }
else if (event.button.x >= (WINDOW_WIDTH - img_scroll_up->w) / 2 && else if (event.button.x >= (WINDOW_WIDTH - img_scroll_up->w) / 2 &&
event.button.x <= (WINDOW_WIDTH + img_scroll_up->w) / 2) event.button.x <= (WINDOW_WIDTH + img_scroll_up->w) / 2)