Hi, I have defined interfaces like following.
unit Interface1
interface
type
IDBAccess = interface
//...
end;
var
DBAccess: IDBAccess;
implementation
// ...
end.
unit dModule1
interface
uses Interface1;
type
Tdm1 = class (TDataModule, IDBAccess)
.....
end;
implementation
procedure Tdm1.DataModuleCreate(Sender:TObject);
begin
IDBAccess := Self;
end;
// ...
end.
But this calls SIGSEV error when closing the application. I've read somewhere that interfaces do reference counting and when there are no objects it try to destroy implementing object. Does the error occur because of either interface or object try to destroy the object which was destroyed already by the other?
Or, does my way of using interface have serious problem? I did not have any problem when I declared interface field (i.e. DBAccess here) within class.