fixed buffer overrun and added several checks

git-svn-id: trunk@1343 -
This commit is contained in:
mattias 2002-02-09 01:48:18 +00:00
parent 7f5f2fa537
commit e7fd2f8832

View File

@ -1329,9 +1329,9 @@ begin
end; end;
end; end;
{------------------------------------------------------------------------------} {------------------------------------------------------------------------------
{ TControl Notification } TControl Notification
{------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
procedure TControl.Notification( AComponent : TComponent; Operation : TOperation); procedure TControl.Notification( AComponent : TComponent; Operation : TOperation);
begin begin
inherited Notification(AComponent, Operation); inherited Notification(AComponent, Operation);
@ -1340,15 +1340,16 @@ begin
end; end;
{------------------------------------------------------------------------------} {------------------------------------------------------------------------------
{ TControl GetText } TControl GetText
{------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
function TControl.GetText: TCaption; function TControl.GetText: TCaption;
begin begin
Assert(False, 'Trace:[TControl.GetText]'); Assert(False, 'Trace:[TControl.GetText]');
if (Self is TWinControl) if (Self is TWinControl)
and TWinControl(Self).HandleAllocated and TWinControl(Self).HandleAllocated
and (not (csLoading in ComponentState))
and InterfaceObject.GetText(Self, Result) and InterfaceObject.GetText(Self, Result)
then Assert(False, Format('Trace:[TControl.GetText] %s got: "%s"', [ClassName, Result])) then Assert(False, Format('Trace:[TControl.GetText] %s got: "%s"', [ClassName, Result]))
else Result := FCaption; else Result := FCaption;
@ -1356,17 +1357,17 @@ begin
Assert(False, 'Trace:<TControl.GetText> End'); Assert(False, 'Trace:<TControl.GetText> End');
end; end;
{------------------------------------------------------------------------------} {------------------------------------------------------------------------------
{ TControl IsCaptionStored } TControl IsCaptionStored
{------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
Function TControl.IsCaptionStored : Boolean; Function TControl.IsCaptionStored : Boolean;
Begin Begin
Result := true; Result := true;
end; end;
{------------------------------------------------------------------------------} {------------------------------------------------------------------------------
{ TControl InvalidateControl } TControl InvalidateControl
{------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
procedure TControl.InvalidateControl(IsVisible, IsOpaque : Boolean); procedure TControl.InvalidateControl(IsVisible, IsOpaque : Boolean);
var var
Rect: TRect; Rect: TRect;
@ -1832,8 +1833,7 @@ end;
{------------------------------------------------------------------------------} {------------------------------------------------------------------------------}
procedure TControl.SetText(const Value: TCaption); procedure TControl.SetText(const Value: TCaption);
begin begin
if GetText <> value if GetText = Value then exit;
then begin
// Need to set FCaption otherwise those components that simply // Need to set FCaption otherwise those components that simply
// check FCaption will always be wrong. // check FCaption will always be wrong.
FCaption := Value; FCaption := Value;
@ -1841,7 +1841,6 @@ begin
if Self is TWinControl then if Self is TWinControl then
SetTextBuf(PChar(FCaption)); SetTextBuf(PChar(FCaption));
end; end;
end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
Method: TControl.Destroy Method: TControl.Destroy
@ -2042,6 +2041,9 @@ end;
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.103 2002/11/18 13:38:44 mattias
fixed buffer overrun and added several checks
Revision 1.102 2002/11/16 14:38:48 mattias Revision 1.102 2002/11/16 14:38:48 mattias
fixed TControl.Show and Visible of designer forms fixed TControl.Show and Visible of designer forms