 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Mattias Andersson Guest
|
Posted: Fri Nov 17, 2006 12:59 am Post subject: Bug in IsDefaultPropertyValue? |
|
|
Hi all,
I'm writing my own custom streaming routines for TPersistent based objects
in Delphi 7.
Now, it seems that I've come across a glitch in one of the streaming
functions. The function that causes the problem is 'IsDefaultPropertyValue',
which I believe is used to highlight non-default values in the Object
Inspector. Apparently this is also one of two functions that were added to
the Classes unit in Delphi 7.
The problem is a nil-pointer dereference error inside IsDefaultMethodProp at
the following line:
Result := (Value.Code = DefaultCode) or
((Value.Code <> nil) and (LookupRoot.MethodName(Value.Code) = ''));
I think an additional test is needed here to ensure that LookupRoot is
actually assigned.
See the test case below in order to reproduce the problem.
Do you think that this should be reported to QC?
Kind regards,
Mattias Andersson
uses
Classes, TypInfo;
type
TMyClass = class(TPersistent)
private
FOnEvent: TNotifyEvent;
procedure DummyMethod(Sender: TObject);
published
property OnEvent: TNotifyEvent read FOnEvent write FOnEvent;
end;
procedure TMyClass.DummyMethod(Sender: TObject);
begin
end;
procedure TForm1.Button1Click(Sender: TObject);
var
MyClass: TMyClass;
PropInfo: PPropInfo;
begin
MyClass := TMyClass.Create;
try
MyClass.OnEvent := MyClass.DummyMethod;
PropInfo := GetPropInfo(MyClass, 'OnEvent');
IsDefaultPropertyValue(MyClass, PropInfo, nil);
finally
MyClass.Free;
end;
end; |
|
| Back to top |
|
 |
Sebastian Modersohn Guest
|
Posted: Wed Nov 22, 2006 7:03 am Post subject: Re: Bug in IsDefaultPropertyValue? |
|
|
| Quote: | Do you think that this should be reported to QC?
|
I'd say yes, especially since you've got a handy small test-case. Note that
..opentoolsapi is not best group since this applies to the VCL and the QC
should also be filed against the VCL\Core VCL Classes\Streaming area.
--
Sebastian |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|