Browse Source

Invalid assertion, caused by Issue 2235

Source commit: d92c8a0952390a65d49a2f2e61ebdea8e814b5ca
Martin Prikryl 1 year ago
parent
commit
6368c3f192
2 changed files with 7 additions and 14 deletions
  1. 7 13
      source/core/SftpFileSystem.cpp
  2. 0 1
      source/core/SftpFileSystem.h

+ 7 - 13
source/core/SftpFileSystem.cpp

@@ -1921,7 +1921,12 @@ __fastcall TSFTPFileSystem::TSFTPFileSystem(TTerminal * ATerminal,
 __fastcall TSFTPFileSystem::~TSFTPFileSystem()
 {
   delete FSupport;
-  NoPacketReservations();
+  // After closing, we can only possibly have "discard" reservations of the not-read responses to the last requests
+  // (typically to SSH_FXP_CLOSE)
+  for (int i = 0; i < FPacketReservations->Count; i++)
+  {
+    DebugAssert(FPacketReservations->Items[i] == NULL);
+  }
   delete FPacketReservations;
   delete FFixedPaths;
   delete FSecureShell;
@@ -1929,22 +1934,11 @@ __fastcall TSFTPFileSystem::~TSFTPFileSystem()
 //---------------------------------------------------------------------------
 void __fastcall TSFTPFileSystem::Open()
 {
-  NoPacketReservations();
-  ResetConnection();
   // this is used for reconnects only
+  ResetConnection();
   FSecureShell->Open();
 }
 //---------------------------------------------------------------------------
-void TSFTPFileSystem::NoPacketReservations()
-{
-  // After closing, we can only possibly have "discard" reservations of the not-read responses to the last requests
-  // (typocally to SSH_FXP_CLOSE)
-  for (int i = 0; i < FPacketReservations->Count; i++)
-  {
-    DebugAssert(FPacketReservations->Items[i] == NULL);
-  }
-}
-//---------------------------------------------------------------------------
 void __fastcall TSFTPFileSystem::Close()
 {
   FSecureShell->Close();

+ 0 - 1
source/core/SftpFileSystem.h

@@ -199,7 +199,6 @@ protected:
     TFileOperationProgressType * OperationProgress);
   bool __fastcall DoesFileLookLikeSymLink(TRemoteFile * File);
   void DoCloseRemoteIfOpened(const RawByteString & Handle);
-  void NoPacketReservations();
 };
 //---------------------------------------------------------------------------
 #endif // SftpFileSystemH