r19687 - gnucash/trunk/src/gnome-utils - Bug 632166: Restore the old session if "save as" fails.
jralls at code.gnucash.org
Tue Oct 19 23:35:03 EDT 2010
Date: 2010-10-19 23:35:02 -0400 (Tue, 19 Oct 2010)
New Revision: 19687
Bug 632166: Restore the old session if "save as" fails.
Save as would make a new session the "current session" and attempt to
save it. If it failed, the new session (with an invalid database)
would remain the current session -- and would be marked clean. An
XML-only file-save-as dialog would be presented with no instructions
about what was going on.
With this change, if the "save as" fails, the old session is restored,
still marked unsaved. This should be much less confusing to users and
more likely to avoid data loss.
Yes, there's some duplicated code now, because do_save_as doesn't call
save. That's because save did some extra things that do_save_as
doesn't need and it didn't allow do_save_as to properly correct the
session. This could be refactored into some tiny functions, but that
seems a bit excessive to me.
More information about the gnucash-patches