In some of my applications I override the TCustomForm.CreateNew constructor to do some intialization before the DFM resource is loaded. Today I migrated one of these projects to Delphi 2009 and I got an access violation because an object was nil. Looking at the code that worked in Delphi 2007 I didn’t see the problem because the object is created in CreateNew which is executed before the OnCreate event and it is only destroyed in the destructor. But for some strange reasons the CreateNew constructor isn’t executed anymore.
CreateNew isn’t executed anymore because CodeGear has changed the behavior of the Create constructor. Create doesn’t call CreateNew anymore but both constructors now call the new dynamic method InitializeNewForm. After changing all my CreateNew constructors to InitializeNewForm methods the application finally started without an access violation.
Calling an InitializeNewForm method from multiple constructors is certainly cleaner than calling overloaded constructors in a chain, but that “clean up” will certainly cause some headache if you don’t know about it. Thanks for the hint!
And that’s the problem. There was no information about this change. I had to find this change in behavior the hard way.
One thing I do after installing a new version of Delphi is to do a Beyond Compare comparison of the Delphi source directories. I can then quickly look over the changes to the VCL.