Browse Source

* Properly nest beginupdate/endupdate in doaddobject

Michaël Van Canneyt 11 months ago
parent
commit
8139c0a8bd
1 changed files with 7 additions and 9 deletions
  1. 7 9
      rtl/objpas/classes/stringl.inc

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

@@ -1946,16 +1946,14 @@ begin
         DupIgnore : Exit;
         DupError : Error(SDuplicateString,0)
       end;
-   InsertItem (Result,S);  
-   if (aObject<>Nil) then 
-     begin
-     BeginUpdate;
-     try
+   BeginUpdate;
+   try
+     InsertItem (Result,S);  
+     if (aObject<>Nil) then 
       Objects[Result]:=AObject;
-     finally
-       EndUpdate;
-     end;
-     end;
+   finally
+     EndUpdate;
+   end;
 end;
 
 function TStringList.Add(const S: string): Integer;