[fpc-devel] Interface delegation fix: backport to FPC 2.4.2 ...?
Graeme Geldenhuys
graemeg.lists at gmail.com
Wed May 19 13:05:49 CEST 2010
Martin Schreiber het geskryf:
>
> Maybe
> http://bugs.freepascal.org/view.php?id=16365
> must be fixed too until you can use interface delegation to a class?
That seems to be a bug only in COM interfaces. I want to use Corba
interfaces which do not AV.
The same example as the one in the bug report, but with Corba interfaces
enabled. No AV with current 2.5.1
-----------[ delegation.pas ]---------------------
program delegation;
{$ifdef FPC}
{$mode objfpc}{$h+}
{$interfaces corba}
{$endif}
uses
sysutils;
type
itest = interface
procedure test;
end;
timpclass = class(tobject,itest)
private
procedure test;
end;
ttestclass = class(tobject,itest)
private
fimp: timpclass;
property imp: timpclass read fimp implements itest;
public
constructor create;
destructor destroy; override;
end;
{ timpclass }
procedure timpclass.test;
begin
writeln('test');
end;
{ ttestclass }
constructor ttestclass.create;
begin
fimp:= timpclass.create;
end;
destructor ttestclass.destroy;
begin
inherited;
fimp.free;
end;
var
testclass: ttestclass;
begin
testclass:= ttestclass.create;
itest(testclass).test; //<<<<---- No more AV!
testclass.free;
end.
--------------------------------
Here is the output I get under Ubuntu 8.04.3 (64-bit).
$ /opt/fpc_2.5.1/x86_64-linux/bin/ppcx64 delegation.pas
Free Pascal Compiler version 2.5.1 [2010/05/14] for x86_64
Copyright (c) 1993-2009 by Florian Klaempfl
tmp $ ./delegation
test
tmp $
Regards,
- Graeme -
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://opensoft.homeip.net/fpgui/
More information about the fpc-devel
mailing list