diff --git a/ChangeLog b/ChangeLog index ad8414ac8..b0e22554f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2009-09-03 David Capello + + * Version 0.7.2 released. + + * src/commands/cmd_close_file.cpp (close_current_sprite): Fixed + bug #2847210: "Save" button when close a modified file was not working. + 2009-08-10 David A. Capello * Version 0.7.1 released. diff --git a/NEWS.txt b/NEWS.txt index c17802078..96b398517 100644 --- a/NEWS.txt +++ b/NEWS.txt @@ -2,6 +2,12 @@ NEWS =================================== +0.7.2 +----- + ++ Fixed bug #2847210: "Save" button when close a modified file was + not working. + 0.7.1 ----- diff --git a/data/tips/tips.en b/data/tips/tips.en index e0aa3fec5..1036f54fc 100644 --- a/data/tips/tips.en +++ b/data/tips/tips.en @@ -5,7 +5,7 @@ \palette ase.pcx \image ase.pcx -Welcome to ASE 0.7.1 +Welcome to ASE 0.7.2 READ THIS! diff --git a/misc/dist.sh b/misc/dist.sh index 20e104484..5d978daa5 100644 --- a/misc/dist.sh +++ b/misc/dist.sh @@ -1,7 +1,7 @@ #! /bin/sh dir="`pwd`" -version=0.7.1 +version=0.7.2 distdir=ase-$version freetype_files="third_party/freetype/ChangeLog \ diff --git a/src/commands/cmd_close_file.cpp b/src/commands/cmd_close_file.cpp index 67a6d1ce7..a16e6af80 100644 --- a/src/commands/cmd_close_file.cpp +++ b/src/commands/cmd_close_file.cpp @@ -74,33 +74,51 @@ static void cmd_close_all_files_execute(const char *argument) */ static bool close_current_sprite() { - CurrentSpriteWriter sprite; + bool save_it; - /* see if the sprite has changes */ - while (sprite_is_modified(sprite)) { - /* ask what want to do the user with the changes in the sprite */ - int ret = jalert("%s<<%s<<%s||%s||%s||%s", - _("Warning"), _("Saving changes in:"), - get_filename(sprite->filename), - _("&Save"), _("&Discard"), _("&Cancel")); +try_again:; + // This flag indicates if we have to sabe the sprite before to destroy it + save_it = false; + { + // The sprite is locked as reader temporaly + CurrentSpriteReader sprite; - if (ret == 1) { - /* "save": save the changes */ - // TODO we have to pass the sprite to the save file command - command_execute(command_get_by_name(CMD_SAVE_FILE), NULL); - } - else if (ret != 2) { - /* "cancel" or "ESC" */ - return false; /* we back doing nothing */ - } - else { - /* "discard" */ - break; + /* see if the sprite has changes */ + while (sprite_is_modified(sprite)) { + /* ask what want to do the user with the changes in the sprite */ + int ret = jalert("%s<<%s<<%s||%s||%s||%s", + _("Warning"), _("Saving changes in:"), + get_filename(sprite->filename), + _("&Save"), _("&Discard"), _("&Cancel")); + + if (ret == 1) { + /* "save": save the changes */ + save_it = true; + break; + } + else if (ret != 2) { + /* "cancel" or "ESC" */ + return false; /* we back doing nothing */ + } + else { + /* "discard" */ + break; + } } } - /* closes the sprite */ - sprite.destroy(); + // Does we need to save the sprite? + if (save_it) { + // TODO we have to pass the sprite to the save file command + command_execute(command_get_by_name(CMD_SAVE_FILE), NULL); + goto try_again; + } + + // Destroy the sprite (locking it as writer) + { + CurrentSpriteWriter sprite; + sprite.destroy(); + } return true; }