lcl: fix crashes when using buttonpanel on form (default conrol has not notified form about destruction)

git-svn-id: trunk@19577 -
This commit is contained in:
paul 2009-04-23 02:35:18 +00:00
parent fb5ae56005
commit ce343a5f24
2 changed files with 12 additions and 3 deletions

View File

@ -32,6 +32,9 @@ const
DefShowGlyphs = [pbOK, pbCancel, pbClose, pbHelp];
type
{ TPanelBitBtn }
TPanelBitBtn = class(TCustomBitBtn)
public
constructor Create(AOwner: TComponent); override;

View File

@ -217,14 +217,20 @@ var
begin
if NewControl <> FDefaultControl then
begin
OldDefaultControl:=FDefaultControl;
OldDefaultControl := FDefaultControl;
FDefaultControl := NewControl;
// notify old control
if OldDefaultControl<>nil then
if OldDefaultControl <> nil then
begin
OldDefaultControl.RemoveFreeNotification(Self);
OldDefaultControl.UpdateRolesForForm;
end;
// notify new control
if FDefaultControl<>nil then
if FDefaultControl <> nil then
begin
FDefaultControl.FreeNotification(Self);
FDefaultControl.UpdateRolesForForm;
end;
// maybe active default control changed
if FActiveDefaultControl = nil then
begin