浏览代码

Issue 2283 – Failure when closing the last remote tab

https://winscp.net/tracker/2283

Source commit: 10dd97ae318441353114eda2d5300f13f5805a6a
Martin Prikryl 1 年之前
父节点
当前提交
a5152c6eb8
共有 1 个文件被更改,包括 5 次插入3 次删除
  1. 5 3
      source/forms/ScpCommander.cpp

+ 5 - 3
source/forms/ScpCommander.cpp

@@ -2290,15 +2290,17 @@ void __fastcall TScpCommanderForm::DoLocalPathComboBoxAdjustImageIndex(
   if (FLocalPathComboBoxPaths != NULL)
   {
     TTBXComboBoxItem * PathComboBox = DebugNotNull(dynamic_cast<TTBXComboBoxItem *>(Sender));
-    DebugAssert(FLocalPathComboBoxPaths->Count == PathComboBox->Strings->Count);
-    DebugAssert(AIndex < FLocalPathComboBoxPaths->Count);
+    DebugAssert(FSessionChanging || (FLocalPathComboBoxPaths->Count == PathComboBox->Strings->Count));
+    DebugAssert(FSessionChanging || (AIndex < FLocalPathComboBoxPaths->Count));
 
     if (AIndex < 0)
     {
       AIndex = PathComboBox->ItemIndex;
     }
 
-    if (AIndex >= 0)
+    // We might get called via some Windows messages while switching from remote to local tab (FSessionChanging),
+    // before the UpdateRemotePathComboBox gets called. If that happens, ignore the call.
+    if ((AIndex >= 0) && (AIndex < FLocalPathComboBoxPaths->Count))
     {
       ImageIndex = int(FLocalPathComboBoxPaths->Objects[AIndex]);
     }