Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2019-01

Custom TStrings descendents

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Michael Van Canneyt

Hi,

Please check the TStrings descendents in

lcl/interfaces/qt5/qtobjects.pas (Line 4763)
ide/inputhistory.pas (Line 676)
components/fpvectorial/docxvectorialwriter.pas (line 414) lcl/interfaces/cocoa/cocoatextedits.pas (line 1146)

They are not calling the inherited constructor.
As a result, LoadFromFile() will crash, since no default encoding is present. (the default encoding is set in the constructor)

Unless you know what you are doing, you must always call the inherited constructor, if there is one. You must give the parent class the chance to initialize itself correctly. It's not because a particular constructor is empty today, that it will be empty tomorrow.

Michael.

PS. And yes, this requirement *is* Delphi compatible.

Reply by email