浏览代码

Bug fix: Failure when opening workspace with local-local tab in Explorer interface (2nd after 43e8bfcc)

Source commit: e6a4d1ef2f7ec96ca0acb4f06d0f09230233d71a
Martin Prikryl 3 年之前
父节点
当前提交
ca3c2a61a6
共有 2 个文件被更改,包括 22 次插入1 次删除
  1. 21 1
      source/windows/TerminalManager.cpp
  2. 1 0
      source/windows/TerminalManager.h

+ 21 - 1
source/windows/TerminalManager.cpp

@@ -237,13 +237,33 @@ TManagedTerminal * __fastcall TTerminalManager::NewManagedTerminal(TSessionData
   return DebugNotNull(dynamic_cast<TManagedTerminal *>(NewTerminal(Data)));
 }
 //---------------------------------------------------------------------------
+bool TTerminalManager::SupportedSession(TSessionData * Data)
+{
+  bool Result;
+  // When main window exists already, ask it if it supports the session
+  // (we cannot decide based on configuration,
+  // as the user might have changed the interface in the preferences after the main window was created)
+  // If not, assume based on configuration.
+  if (ScpExplorer != NULL)
+  {
+    Result = ScpExplorer->SupportedSession(Data);
+  }
+  else
+  {
+    Result =
+      (WinConfiguration->Interface != ifExplorer) ||
+      !Data->IsLocalBrowser;
+  }
+  return Result;
+}
+//---------------------------------------------------------------------------
 TManagedTerminal * __fastcall TTerminalManager::NewSessions(TList * DataList)
 {
   TManagedTerminal * Result = NULL;
   for (int Index = 0; Index < DataList->Count; Index++)
   {
     TSessionData * Data = reinterpret_cast<TSessionData *>(DataList->Items[Index]);
-    if (ScpExplorer->SupportedSession(Data))
+    if (SupportedSession(Data))
     {
       TManagedTerminal * Session = DoNewSession(Data);
       // When opening workspace/folder, keep the sessions open, even if they fail to connect.

+ 1 - 0
source/windows/TerminalManager.h

@@ -194,6 +194,7 @@ private:
   TManagedTerminal * __fastcall CreateManagedTerminal(TSessionData * Data);
   TManagedTerminal * __fastcall GetSession(int Index);
   bool IsUpdating();
+  bool SupportedSession(TSessionData * Data);
 };
 //---------------------------------------------------------------------------
 #endif