浏览代码

Bug 2175: The first copy&paste of remote files to other application might fail in Explorer interface

https://winscp.net/tracker/2175

Source commit: 6a0327fcfcbfacd6950e3474302361728ead64c6
Martin Prikryl 2 年之前
父节点
当前提交
dc83ccd37e
共有 2 个文件被更改,包括 8 次插入1 次删除
  1. 3 0
      source/forms/CustomScpExplorer.cpp
  2. 5 1
      source/packages/filemng/IEDriveInfo.pas

+ 3 - 0
source/forms/CustomScpExplorer.cpp

@@ -291,6 +291,9 @@ __fastcall TCustomScpExplorerForm::TCustomScpExplorerForm(TComponent* Owner):
 
   CreateHiddenWindow();
   StartUpdates();
+  // Start loading drive data, so that they are ready once we need them for StartCreationDirectoryMonitorsOnEachDrive
+  // (necessary for "explorer" only, as "commander" loads it for its drive menu)
+  DriveInfo->NeedData();
 }
 //---------------------------------------------------------------------------
 __fastcall TCustomScpExplorerForm::~TCustomScpExplorerForm()

+ 5 - 1
source/packages/filemng/IEDriveInfo.pas

@@ -85,7 +85,6 @@ type
     procedure ResetDrive(Drive: string);
     procedure SetHonorDrivePolicy(Value: Boolean);
     function GetFirstFixedDrive: Char;
-    procedure NeedData;
     procedure Load;
     function AddDrive(Drive: string): TDriveInfoRec;
 
@@ -93,6 +92,7 @@ type
     function Get(Drive: string): TDriveInfoRec;
     property SpecialFolder[Folder: TSpecialFolder]: PSpecialFolderRec read GetFolder;
 
+    procedure NeedData;
     function AnyValidPath: string;
     function GetDriveKey(Path: string): string;
     function GetDriveRoot(Drive: string): string;
@@ -466,6 +466,10 @@ end;
 function TDriveInfo.Get(Drive: string): TDriveInfoRec;
 begin
   NeedData;
+
+  // We might want to wait for ReadyDrives to beempty before returning
+  // (or even better do that only in DriveReady getter)
+
   if not FData.TryGetValue(Drive, Result) then
   begin
     Assert(IsUncPath(Drive));