[fpc-pascal] Using Supports() I got an AV... bug?
Marcos Douglas B. Santos
md at delfire.net
Sun Mar 11 14:23:08 CET 2018
The code below should work but I get an AV when the program calls
`Bar.Free`.
Do you know why?
Lazarus 1.8.1 r57299 FPC 3.0.4 i386-win32-win32/win64
===begin===
program Project1;
uses
SysUtils;
type
IBar = interface
['{C22FB8F4-1EC6-42C4-81E4-F2A52CC52258}']
function Name: string;
end;
TBar = class(TInterfacedObject, IBar)
public
function Name: string;
end;
{ TBar }
function TBar.Name: string;
begin
Result := ClassName;
end;
var
Bar: TBar;
begin
Bar := TBar.Create;
try
if Supports(Bar, IBar) then
Writeln('Bar supports...');
finally
Bar.Free;
end;
end.
===end===
Regards,
Marcos Douglas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20180311/c8a2a4b8/attachment.html>
More information about the fpc-pascal
mailing list