diff --git a/src/Services/Document.vala b/src/Services/Document.vala index 09f98fa83..2f5b89691 100644 --- a/src/Services/Document.vala +++ b/src/Services/Document.vala @@ -130,6 +130,7 @@ namespace Scratch.Services { private ulong onchange_handler_id = 0; // It is used to not mark files as changed on load private bool loaded = false; private bool mounted = true; // Mount state of the file + private bool closing = false; private Mount mount; private Icon locked_icon; @@ -466,7 +467,7 @@ namespace Scratch.Services { if (ret_value) { // Delete backup copy file - loaded = false; // Stops recreating backup when trailing space stripped + closing = true; // Stops recreating backup when trailing space stripped delete_backup (); doc_closed (); } @@ -1006,7 +1007,7 @@ namespace Scratch.Services { // Backup functions private void create_backup () { - if (!can_write () || !loaded) { + if (!can_write () || closing) { return; }