Kaynağa Gözat

Bug 1552: Do not close application when initial Login dialog is closed without opening session and "Keep main window open when the last session is closed" is OnKeyDown

https://winscp.net/tracker/1552

Source commit: 453f724bcbbdc1817ddf03d3fa233e072d1d8ef8
Martin Prikryl 8 yıl önce
ebeveyn
işleme
7a14f7e470
1 değiştirilmiş dosya ile 17 ekleme ve 16 silme
  1. 17 16
      source/forms/CustomScpExplorer.cpp

+ 17 - 16
source/forms/CustomScpExplorer.cpp

@@ -5903,31 +5903,32 @@ void __fastcall TCustomScpExplorerForm::LastTerminalClosed(TObject * /*Sender*/)
   UpdateControls();
   SessionColor = TColor(0);
   UpdateRemotePathComboBox(false);
-  try
-  {
-    NeedSession(true);
-  }
-  catch (EAbort &)
-  {
-    // swallow
-    // The TTerminalManager does not expect the OnLastTerminalClose to throw without trying to connect
-  }
+  NeedSession(true);
 }
 //---------------------------------------------------------------------------
 void __fastcall TCustomScpExplorerForm::NeedSession(bool ReloadSessions)
 {
   try
   {
-    TTerminalManager::Instance()->NewSession(false, L"", ReloadSessions, this);
-  }
-  __finally
-  {
-    if (!WinConfiguration->KeepOpenWhenNoSession &&
-        (!Terminal || !Terminal->Active))
+    try
     {
-      TerminateApplication();
+      TTerminalManager::Instance()->NewSession(false, L"", ReloadSessions, this);
+    }
+    __finally
+    {
+      if (!WinConfiguration->KeepOpenWhenNoSession &&
+          (!Terminal || !Terminal->Active))
+      {
+        TerminateApplication();
+      }
     }
   }
+  catch (EAbort &)
+  {
+    // swallow
+    // The TTerminalManager does not expect the OnLastTerminalClose to throw without trying to connect.
+    // Also when called from TWinControl.UpdateShowing => CMShowingChanged, the showing is aborted on exception
+  }
 }
 //---------------------------------------------------------------------------
 void __fastcall TCustomScpExplorerForm::DoTerminalListChanged(bool Force)