Thursday, April 2, 2009

Delphi 2009 Serious bug in Forms.pas

There is a serious bug in the Forms.pas of Delphi 2009. A “stdcall” directive got lost in the transition from Delphi 2007 to Delphi 2009. This missing directive is visible via QC #66892 (Closing forms deactivates the application) and what is worse it trashes the stack and the application can vanish or raise an access violation if a form is closed or hidden. It is a ticking time bomb if you want.
But no worry, I have written a little bugfix unit that patches the defect Forms.pas function at runtime (no file on disk is modified). Adding this unit to a project is all you have to do. The initialization section of the HideStackTrashingFix.pas will automatically install the runtime patch. This unit can also be used by C++Builder users.
I hope that Update 2 will fix this and make this unit obsolete.

No comments: