destroying clean up

git-svn-id: trunk@6334 -
This commit is contained in:
mattias 2004-12-05 13:25:47 +00:00
parent 5c02893c8b
commit 2efd1ba30a
2 changed files with 10 additions and 5 deletions

View File

@ -1013,10 +1013,7 @@ begin
if (Screen.Forms[I].Menu = Value) and (Screen.Forms[I] <> Self) then
raise EInvalidOperation.CreateFmt(sDuplicateMenus, [Value.Name]);
if FMenu<>nil then begin
FMenu.Parent:=nil;
end;
if FMenu<>nil then FMenu.Parent:=nil;
if (csDestroying in ComponentState) or
((Value <> nil) and (csDestroying in Value.ComponentState))
@ -1823,6 +1820,9 @@ end;
{ =============================================================================
$Log$
Revision 1.167 2004/12/05 13:25:47 mattias
destroying clean up
Revision 1.166 2004/12/05 13:20:29 mattias
destroying TMenu Handle when Set Parent=nil

View File

@ -54,8 +54,10 @@ procedure TMenu.SetParent(const AValue: TComponent);
begin
if FParent=AValue then exit;
FParent:=AValue;
if (Items<>nil) and Items.HandleAllocated then
if (FParent=nil) and (Items<>nil) and Items.HandleAllocated then begin
// disconnect from form
DestroyHandle;
end;
end;
procedure TMenu.ImageListChange(Sender: TObject);
@ -242,6 +244,9 @@ end;
{ =============================================================================
$Log$
Revision 1.28 2004/12/05 13:25:47 mattias
destroying clean up
Revision 1.27 2004/12/05 13:20:29 mattias
destroying TMenu Handle when Set Parent=nil