浏览代码

Bug 1881: Failure after using files from a disconnected session (for example saving an edited file)

https://winscp.net/tracker/1881

Source commit: bc9e5908bbc40bc5f8b4f51ffaca427eeb78dad4
Martin Prikryl 5 年之前
父节点
当前提交
01c9c5f583
共有 2 个文件被更改,包括 11 次插入4 次删除
  1. 10 4
      source/forms/CustomScpExplorer.cpp
  2. 1 0
      source/forms/CustomScpExplorer.h

+ 10 - 4
source/forms/CustomScpExplorer.cpp

@@ -4872,6 +4872,7 @@ void __fastcall TCustomScpExplorerForm::DisconnectSession()
 //---------------------------------------------------------------------------
 void __fastcall TCustomScpExplorerForm::TerminalDisconnected()
 {
+  DetachTerminal(Terminal);
   RemoteDirView->Terminal = Terminal;
   UpdateRemotePathComboBox(false);
   UpdateControls();
@@ -6593,22 +6594,27 @@ void __fastcall TCustomScpExplorerForm::ExecuteCurrentFileWith(bool OnFocused)
   }
 }
 //---------------------------------------------------------------------------
-void __fastcall TCustomScpExplorerForm::TerminalRemoved(TObject * Sender)
+void __fastcall TCustomScpExplorerForm::DetachTerminal(TObject * ATerminal)
 {
-  FEditorManager->ProcessFiles(FileTerminalRemoved, Sender);
+  FEditorManager->ProcessFiles(FileTerminalRemoved, ATerminal);
 
-  if (FFileFindTerminal == Sender)
+  if (FFileFindTerminal == ATerminal)
   {
     FFileFindTerminal = NULL;
     HideFileFindDialog();
   }
 
-  if (FClipboardTerminal == Sender)
+  if (FClipboardTerminal == ATerminal)
   {
     ClipboardClear(); // implies ClipboardStop
   }
 }
 //---------------------------------------------------------------------------
+void __fastcall TCustomScpExplorerForm::TerminalRemoved(TObject * Sender)
+{
+  DetachTerminal(Sender);
+}
+//---------------------------------------------------------------------------
 void __fastcall TCustomScpExplorerForm::FileTerminalRemoved(const UnicodeString FileName,
   TEditedFileData * Data, TObject * /*Token*/, void * Arg)
 {

+ 1 - 0
source/forms/CustomScpExplorer.h

@@ -707,6 +707,7 @@ protected:
   virtual void __fastcall ThemeChanged();
   int __fastcall GetStaticQueuePanelComponentsHeight();
   int __fastcall GetMinQueueViewHeight();
+  void __fastcall DetachTerminal(TObject * ATerminal);
 
 public:
   virtual __fastcall ~TCustomScpExplorerForm();