Преглед на файлове

* Keep old behaviour, but keep issue #40898 solved

Michaël Van Canneyt преди 11 месеца
родител
ревизия
58560d333e
променени са 1 файла, в които са добавени 10 реда и са изтрити 5 реда
  1. 10 5
      rtl/objpas/classes/stringl.inc

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

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