Browse Source

No need to suspend operation, while logging an exception

In the past the predecessor of HandleException probably showed the error, but it did not already in 3.0

Source commit: 9ec53d6edfaef2acf288b0ebbf6f9eb90a242ba4
Martin Prikryl 1 month ago
parent
commit
086aec0991
2 changed files with 6 additions and 24 deletions
  1. 4 11
      source/core/ScpFileSystem.cpp
  2. 2 13
      source/core/Terminal.cpp

+ 4 - 11
source/core/ScpFileSystem.cpp

@@ -1845,13 +1845,10 @@ void __fastcall TSCPFileSystem::CopyToRemote(TStrings * FilesToCopy,
         {
           FTerminal->OperationFinish(OperationProgress, Item, FileName, false, OnceDoneOperation);
 
+          // If ESkipFile occurs, just log it and continue with next file
+          if (!FTerminal->HandleException(&E))
           {
-            TSuspendFileOperationProgress Suspend(OperationProgress);
-            // If ESkipFile occurs, just log it and continue with next file
-            if (!FTerminal->HandleException(&E))
-            {
-              throw;
-            }
+            throw;
           }
         }
         catch (...)
@@ -2247,7 +2244,6 @@ void __fastcall TSCPFileSystem::SCPDirectorySource(const UnicodeString Directory
       catch (ESkipFile &E)
       {
         // If ESkipFile occurs, just log it and continue with next file
-        TSuspendFileOperationProgress Suspend(OperationProgress);
         if (!FTerminal->HandleException(&E))
         {
           throw;
@@ -2587,10 +2583,7 @@ void __fastcall TSCPFileSystem::SCPSink(const UnicodeString TargetDir,
         }
         catch (Exception &E)
         {
-          {
-            TSuspendFileOperationProgress Suspend(OperationProgress);
-            FTerminal->Log->AddException(&E);
-          }
+          FTerminal->Log->AddException(&E);
           SCPError(LoadStr(SCP_ILLEGAL_FILE_DESCRIPTOR), false);
         }
 

+ 2 - 13
source/core/Terminal.cpp

@@ -4204,7 +4204,6 @@ bool __fastcall TTerminal::ProcessFiles(TStrings * FileList,
           }
           catch(ESkipFile & E)
           {
-            TSuspendFileOperationProgress Suspend(OperationProgress);
             if (!HandleException(&E))
             {
               throw;
@@ -6379,7 +6378,6 @@ void __fastcall TTerminal::SynchronizeCollectFile(const UnicodeString FileName,
   }
   catch(ESkipFile & E)
   {
-    TSuspendFileOperationProgress Suspend(OperationProgress);
     if (!HandleException(&E))
     {
       throw;
@@ -7620,7 +7618,6 @@ void __fastcall TTerminal::DoCopyToRemote(
       }
       catch (ESkipFile & E)
       {
-        TSuspendFileOperationProgress Suspend(OperationProgress);
         if (!HandleException(&E))
         {
           throw;
@@ -7746,10 +7743,6 @@ void __fastcall TTerminal::DirectorySource(
       catch (ESkipFile &E)
       {
         // If ESkipFile occurs, just log it and continue with next file
-        TSuspendFileOperationProgress Suspend(OperationProgress);
-        // here a message to user was displayed, which was not appropriate
-        // when user refused to overwrite the file in subdirectory.
-        // hopefully it won't be missing in other situations.
         if (!HandleException(&E))
         {
           throw;
@@ -8205,7 +8198,6 @@ void __fastcall TTerminal::DoCopyToLocal(
       }
       catch (ESkipFile & E)
       {
-        TSuspendFileOperationProgress Suspend(OperationProgress);
         if (!HandleException(&E))
         {
           throw;
@@ -8486,12 +8478,9 @@ void __fastcall TTerminal::SinkFile(UnicodeString FileName, const TRemoteFile *
   {
     Params->Skipped = true;
 
+    if (!HandleException(&E))
     {
-      TSuspendFileOperationProgress Suspend(Params->OperationProgress);
-      if (!HandleException(&E))
-      {
-        throw;
-      }
+      throw;
     }
 
     if (Params->OperationProgress->Cancel)