Skip to content

Commit

Permalink
Use new flag for closing to avoid side-effects
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeremy Wootten committed Jun 27, 2023
1 parent 5cb4188 commit c8cc85d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Services/Document.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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 ();
}
Expand Down Expand Up @@ -1006,7 +1007,7 @@ namespace Scratch.Services {

// Backup functions
private void create_backup () {
if (!can_write () || !loaded) {
if (!can_write () || closing) {
return;
}

Expand Down

0 comments on commit c8cc85d

Please sign in to comment.