Przeglądaj źródła

Bug fix: When saving a local file, the "Saving" status on the Internal editor status bar is never cleared

Source commit: b661be774d501e0549811eb1559b1bc413d8b63c
Martin Prikryl 4 lat temu
rodzic
commit
25ec2aecbd
1 zmienionych plików z 19 dodań i 7 usunięć
  1. 19 7
      source/forms/Editor.cpp

+ 19 - 7
source/forms/Editor.cpp

@@ -836,15 +836,27 @@ void __fastcall TEditorForm::SaveFile()
   if (IsFileModified())
   {
     DebugAssert(!FFileName.IsEmpty());
-    SaveToFile();
-    if (FOnFileChanged)
+    FSaving = true;
+    UpdateControls(); // It does not redraw the status bar anyway
+    bool Direct = (FOnFileChanged == NULL);
+    try
     {
-      FOnFileChanged(this);
+      SaveToFile();
+      if (!Direct)
+      {
+        FOnFileChanged(this);
+      }
+      EditorMemo->Modified = false;
+      NewFile = false;
+    }
+    __finally
+    {
+      if (Direct)
+      {
+        FSaving = false;
+      }
+      UpdateControls();
     }
-    FSaving = true;
-    EditorMemo->Modified = false;
-    NewFile = false;
-    UpdateControls();
   }
 }
 //---------------------------------------------------------------------------