Преглед изворни кода

* Fixed bug #23477

git-svn-id: trunk@23135 -
michael пре 12 година
родитељ
комит
11a531ab62
2 измењених фајлова са 13 додато и 9 уклоњено
  1. 1 0
      rtl/objpas/classes/classesh.inc
  2. 12 9
      rtl/objpas/classes/stringl.inc

+ 1 - 0
rtl/objpas/classes/classesh.inc

@@ -725,6 +725,7 @@ type
     FDuplicates: TDuplicates;
     FCaseSensitive : Boolean;
     FSorted: Boolean;
+    FForceSort : Boolean;
     FOwnsObjects : Boolean;
     procedure ExchangeItems(Index1, Index2: Integer);
     procedure Grow;

+ 12 - 9
rtl/objpas/classes/stringl.inc

@@ -1260,14 +1260,17 @@ end;
 
 
 procedure TStringList.SetCaseSensitive(b : boolean);
-  begin
-        if b<>FCaseSensitive then
-          begin
-                FCaseSensitive:=b;
-            if FSorted then
-              sort;
-          end;
-  end;
+begin
+  if b=FCaseSensitive then
+    Exit;
+  FCaseSensitive:=b;
+  if FSorted then
+    begin
+    FForceSort:=True;
+    sort;
+    FForceSort:=False;
+    end;
+end;
 
 
 Function TStringList.DoCompareText(const s1,s2 : string) : PtrInt;
@@ -1338,7 +1341,7 @@ end;
 Procedure TStringList.CustomSort(CompareFn: TStringListSortCompare);
 
 begin
-  If Not Sorted and (FCount>1) then
+  If (FForceSort or (Not Sorted)) and (FCount>1) then
     begin
     Changing;
     QuickSort(0,FCount-1, CompareFn);