The following code troubles me. I simply do not understand it:
procedure TsCustomDateEdit.PopupWindowShow;
begin
FreeAndNil(FPopupWindow);
if sPopupCalendar <> nil then
sPopupCalendar.Close;
FPopupWindow := TsPopupCalendar.Create(Self);
sPopupCalendar := TForm(FPopupWindow);
If FPopupWindow contains sPopupCalendar after FreeAndNil(FPopupWindow) sPopupCalendar points to empty space. If sPopupCalendar still contains the correct form pointer then it is overwritten in the last statement, and the memory for the form is lost (because the Close dose a Hide, not a Free).
In other words, should the coding not be this:
procedure TsCustomDateEdit.PopupWindowShow;
begin
if sPopupCalendar <> nil then
sPopupCalendar.Close;
FreeAndNil(FPopupWindow);
FPopupWindow := TsPopupCalendar.Create(Self);
sPopupCalendar := TForm(FPopupWindow);