Explorar o código

Bug 1545: Uploads of saved edited files can rarely stop working

https://winscp.net/tracker/1545

Source commit: 21300dcd5671d102cc779eae3a5c44591fcd8bee
Martin Prikryl %!s(int64=8) %!d(string=hai) anos
pai
achega
1e68de2e19
Modificáronse 1 ficheiros con 25 adicións e 23 borrados
  1. 25 23
      source/windows/EditorManager.cpp

+ 25 - 23
source/windows/EditorManager.cpp

@@ -267,7 +267,7 @@ void __fastcall TEditorManager::Check()
         {
           if (!EarlyClose(Index))
           {
-            // CheckFileChange may fail (file is already being uploaded),
+            // CheckFileChange may fail,
             // but we want to close handles anyway
             CloseFile(Index, false, true);
           }
@@ -463,33 +463,35 @@ void __fastcall TEditorManager::CheckFileChange(int Index, bool Force)
     if (FileData->UploadCompleteEvent != INVALID_HANDLE_VALUE)
     {
       FileData->Reupload = true;
-      Abort();
     }
-    FileData->UploadCompleteEvent = CreateEvent(NULL, false, false, NULL);
-    FUploadCompleteEvents.push_back(FileData->UploadCompleteEvent);
-
-    FileData->Timestamp = NewTimestamp;
-    FileData->Saves++;
-    if (FileData->Saves == 1)
+    else
     {
-      Configuration->Usage->Inc(L"RemoteFilesSaved");
-    }
-    Configuration->Usage->Inc(L"RemoteFileSaves");
+      FileData->UploadCompleteEvent = CreateEvent(NULL, false, false, NULL);
+      FUploadCompleteEvents.push_back(FileData->UploadCompleteEvent);
 
-    try
-    {
-      DebugAssert(OnFileChange != NULL);
-      OnFileChange(FileData->FileName, FileData->Data,
-        FileData->UploadCompleteEvent);
-    }
-    catch(...)
-    {
-      // upload failed (was not even started)
-      if (FileData->UploadCompleteEvent != INVALID_HANDLE_VALUE)
+      FileData->Timestamp = NewTimestamp;
+      FileData->Saves++;
+      if (FileData->Saves == 1)
       {
-        UploadComplete(Index);
+        Configuration->Usage->Inc(L"RemoteFilesSaved");
+      }
+      Configuration->Usage->Inc(L"RemoteFileSaves");
+
+      try
+      {
+        DebugAssert(OnFileChange != NULL);
+        OnFileChange(FileData->FileName, FileData->Data,
+          FileData->UploadCompleteEvent);
+      }
+      catch(...)
+      {
+        // upload failed (was not even started)
+        if (FileData->UploadCompleteEvent != INVALID_HANDLE_VALUE)
+        {
+          UploadComplete(Index);
+        }
+        throw;
       }
-      throw;
     }
   }
 }