mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-11 12:58:11 +02:00

except block that deals with exceptions raised inside the constructor (including afterconstruction), so that afterconstruction is always called after all temps have been finalised (necessary because in case of tinterfacedobject it decreases the reference count of the instance without every freeing the instance, so if that is done before a temp that also holds a refernce is finalised, the temp may wrongly free the instance (mantis #16592, #16592) git-svn-id: trunk@15583 -
29 lines
334 B
ObjectPascal
29 lines
334 B
ObjectPascal
{ %opt=-g-h }
|
|
|
|
program project1;
|
|
{$mode objfpc}{$H+}
|
|
uses
|
|
SysUtils;
|
|
|
|
type
|
|
TClassA = class(TInterfacedObject,IInterface)
|
|
public
|
|
constructor Create();
|
|
end;
|
|
|
|
constructor TClassA.Create();
|
|
var
|
|
x : IInterface;
|
|
begin
|
|
x := Self;
|
|
end;
|
|
|
|
var
|
|
y : IInterface;
|
|
begin
|
|
HaltOnNotReleased := true;
|
|
y := TClassA.Create();
|
|
end.
|
|
|
|
|