Browse Source

--- Merging r23135 into '.':
U rtl/objpas/classes/classesh.inc
U rtl/objpas/classes/stringl.inc

# revisions: 23135
r23135 | michael | 2012-12-12 16:21:28 +0100 (Wed, 12 Dec 2012) | 1 line
Changed paths:
M /trunk/rtl/objpas/classes/classesh.inc
M /trunk/rtl/objpas/classes/stringl.inc

* Fixed bug #23477

git-svn-id: branches/fixes_2_6@24972 -

marco 12 years ago
parent
commit
0d4719b736
2 changed files with 13 additions and 9 deletions
  1. 1 0
      rtl/objpas/classes/classesh.inc
  2. 12 9
      rtl/objpas/classes/stringl.inc

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

@@ -721,6 +721,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);