Ver Fonte

Bug 1550: Hang when showing overwrite confirmation prompt if GUI font has zero-width tab character

https://winscp.net/tracker/1550

Source commit: 7db97a109717f1c64d343e30faf9dbb96d2a3257
Martin Prikryl há 8 anos atrás
pai
commit
d75ab91dbc
1 ficheiros alterados com 7 adições e 0 exclusões
  1. 7 0
      source/windows/GUITools.cpp

+ 7 - 0
source/windows/GUITools.cpp

@@ -516,6 +516,7 @@ void __fastcall ApplyTabs(
       if (IsEligibleForApplyingTabs(Line, TabPos, Start, Remaining))
       {
         int Width;
+        int Iterations = 0;
         while ((Width = CalculateWidth(Start, CalculateWidthArg)) < MaxWidth)
         {
           int Wider = CalculateWidth(Start + Padding, CalculateWidthArg);
@@ -526,6 +527,12 @@ void __fastcall ApplyTabs(
             break;
           }
           Start += Padding;
+          Iterations++;
+          // In rare case a tab is zero-width with some strange font (like HYLE)
+          if (Iterations > 100)
+          {
+            break;
+          }
         }
         Lines->Strings[Index] = Start + Remaining;
       }