@@ -158,6 +158,8 @@ namespace Scratch.Services {
158158 }
159159 }
160160
161+ public bool closing { get ; private set ; default = false ; }
162+
161163 public Gtk . Stack main_stack;
162164 public Scratch . Widgets . SourceView source_view;
163165 private Scratch . Services . SymbolOutline ? outline = null ;
@@ -181,7 +183,6 @@ namespace Scratch.Services {
181183 private ulong onchange_handler_id = 0 ; // It is used to not mark files as changed on load
182184 private bool loaded = false ;
183185 private bool mounted = true ; // Mount state of the file
184- private bool closing = false ;
185186 private Mount mount;
186187 private Icon locked_icon;
187188
@@ -470,6 +471,9 @@ namespace Scratch.Services {
470471
471472 public async bool do_close (bool app_closing = false ) {
472473 debug (" Closing \"%s\" " , get_basename ());
474+ if (closing) {
475+ return true ;
476+ }
473477
474478 if (! loaded) {
475479 load_cancellable. cancel ();
@@ -488,7 +492,6 @@ namespace Scratch.Services {
488492
489493 // Ask whether to save changes
490494 var parent_window = source_view. get_toplevel () as Gtk . Window ;
491-
492495 var dialog = new Granite .MessageDialog (
493496 _(" Save changes to “%s ” before closing?" ). printf (this . get_basename ()),
494497 _(" If you don't save, changes will be permanently lost." ),
@@ -1155,6 +1158,9 @@ namespace Scratch.Services {
11551158 file. delete ();
11561159 return true ;
11571160 } catch (Error e) {
1161+ if (e is IOError . NOT_FOUND ) {
1162+ return true ;
1163+ }
11581164 warning (" Cannot delete temporary file “%s ”: %s " , file. get_uri (), e. message);
11591165 }
11601166
0 commit comments