Procházet zdrojové kódy

Bug fix: Canceling remote path drop down did not reset it back to the current path

Source commit: b6f7400e1aab58051db320476783e91d348a268a
Martin Prikryl před 5 roky
rodič
revize
1f6a5e63db
1 změnil soubory, kde provedl 10 přidání a 9 odebrání
  1. 10 9
      source/forms/CustomScpExplorer.cpp

+ 10 - 9
source/forms/CustomScpExplorer.cpp

@@ -9568,11 +9568,11 @@ void __fastcall TCustomScpExplorerForm::ResumeWindowLock()
 //---------------------------------------------------------------------------
 void __fastcall TCustomScpExplorerForm::UpdateRemotePathComboBox(bool TextOnly)
 {
+  TTBXComboBoxItem * RemotePathComboBox =
+    reinterpret_cast<TTBXComboBoxItem *>(GetComponent(fcRemotePathComboBox));
+
   if (!TextOnly)
   {
-    TTBXComboBoxItem * RemotePathComboBox =
-      reinterpret_cast<TTBXComboBoxItem *>(GetComponent(fcRemotePathComboBox));
-
     TStrings * Items = RemotePathComboBox->Strings;
     Items->BeginUpdate();
     try
@@ -9593,15 +9593,16 @@ void __fastcall TCustomScpExplorerForm::UpdateRemotePathComboBox(bool TextOnly)
     }
     __finally
     {
-      RemotePathComboBox->ItemIndex = Items->Count - 1;
-      // Setting ItemIndex to -1 does not reset its text
-      if (Items->Count == 0)
-      {
-        RemotePathComboBox->Text = L"";
-      }
       Items->EndUpdate();
     }
   }
+
+  RemotePathComboBox->ItemIndex = RemotePathComboBox->Strings->Count - 1;
+  // Setting ItemIndex to -1 does not reset its text
+  if (RemotePathComboBox->Strings->Count == 0)
+  {
+    RemotePathComboBox->Text = L"";
+  }
 }
 //---------------------------------------------------------------------------
 void __fastcall TCustomScpExplorerForm::RemotePathComboBoxAdjustImageIndex(