From 58560d333eaae261ed84ccdb8fb59166a922c5ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Van=20Canneyt?= Date: Sat, 24 Aug 2024 11:02:42 +0200 Subject: [PATCH] * Keep old behaviour, but keep issue #40898 solved --- rtl/objpas/classes/stringl.inc | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/rtl/objpas/classes/stringl.inc b/rtl/objpas/classes/stringl.inc index d461ead717..4c855c4df5 100644 --- a/rtl/objpas/classes/stringl.inc +++ b/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;