Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix new backup creation during closing a document #1344

Merged
merged 5 commits into from
Dec 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion 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 @@ -468,6 +469,7 @@ namespace Scratch.Services {

if (ret_value) {
// Delete backup copy file
closing = true; // Stops recreating backup when trailing space stripped
delete_backup ();
doc_closed ();
}
Expand Down Expand Up @@ -1044,7 +1046,7 @@ namespace Scratch.Services {

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

Expand Down