From fa760d8a2124e3a3fedc4c628702ecd50d7afc32 Mon Sep 17 00:00:00 2001 From: David Capello Date: Sun, 6 Jul 2014 21:29:36 -0300 Subject: [PATCH] Restore filename if "save as" fails --- src/app/commands/cmd_save_file.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/app/commands/cmd_save_file.cpp b/src/app/commands/cmd_save_file.cpp index 98778ec94..1545f229d 100644 --- a/src/app/commands/cmd_save_file.cpp +++ b/src/app/commands/cmd_save_file.cpp @@ -185,6 +185,7 @@ protected: { ContextWriter writer(reader); Document* documentWriter = writer.document(); + std::string oldFilename = documentWriter->getFilename(); // Change the document file name documentWriter->setFilename(filename.c_str()); @@ -193,6 +194,9 @@ protected: // Save the document save_document_in_background(documentWriter, markAsSaved); + if (documentWriter->isModified()) + documentWriter->setFilename(oldFilename); + update_screen_for_document(documentWriter); } }