<div dir="ltr"><div dir="ltr"></div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Aug 11, 2022 at 4:44 PM Martin Frb via fpc-devel <<a href="mailto:fpc-devel@lists.freepascal.org">fpc-devel@lists.freepascal.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Because you are not supposed to use MaxValue<br>
Instead use GetEnumNameCount<br>
<br>
for I := MinValue to MinValue + GetEnumNameCount(...) - 1 do begin<br>
<br>
The unit name is returned because the TypeDate stores the unitname after <br>
the continuous list of element names. And once you are out of index ...</blockquote><div><br></div><div>Damn, you are right. I fixed it better.</div><div>The MaxValue is used in many places for enum and set properties while GetEnumNameCount() is not used anywhere.</div><div>There are other similar bugs. At least these 2 in propedits.pp look fishy:</div><div>- procedure TSetPropertyEditor.GetProperties<br></div><div>- subfunction IsPropInSet under function IsInteresting</div><div><br></div><div>OK, it was not a bug in FPC code. Sorry.</div><div><br></div><div>Regards,</div><div>Juha</div><div><br></div></div></div>