Browse Source

* Fixed bug #26053

git-svn-id: trunk@27770 -
michael 11 years ago
parent
commit
1d9ac3aa9e
1 changed files with 15 additions and 10 deletions
  1. 15 10
      rtl/objpas/classes/stringl.inc

+ 15 - 10
rtl/objpas/classes/stringl.inc

@@ -975,20 +975,23 @@ Var
   I: Integer;
 
 begin
-  if FOwnsObjects then
+  if FromIndex < FCount then
     begin
-      For I:=FromIndex to FCount-1 do
+      if FOwnsObjects then
+        begin
+          For I:=FromIndex to FCount-1 do
+            begin
+              Flist^[I].FString:='';
+              freeandnil(Flist^[i].FObject);
+            end;
+        end
+      else
         begin
-          Flist^[I].FString:='';
-          freeandnil(Flist^[i].FObject);
+          For I:=FromIndex to FCount-1 do
+            Flist^[I].FString:='';
         end;
-    end
-  else
-    begin
-      For I:=FromIndex to FCount-1 do
-        Flist^[I].FString:='';
+      FCount:=FromIndex;
     end;
-  FCount:=FromIndex;
   if Not ClearOnly then
     SetCapacity(0);
 end;
@@ -1184,6 +1187,8 @@ begin
     begin
     if NewCapacity = 0 then
     begin
+      if FCount > 0 then
+        InternalClear(0,True);
       FreeMem(FList);
       FList := nil;
     end else