LImplementsInterface
variable is about to get cleared.
Stepping through the code makes me believe this is some compiler glitch but I am not completely certain.
Anyhow: the implementation of IImplementsInterface
in this line is superfluous and leads to this issue:
TImplementator = class(TCustomImplementator<TImplementsForm>, IImplementsInterface);
The interface was already implemented in the generic TCustomImplementator<T>
class and the code will just work (*) when you remove it from TImplementator
.
(*) as in there won't be an AV - you still have a memory leak because by using interface delegation you are also delegating the _AddRef
/_Release
calls and you are delegating them to a TComponent
instance - that means you are leaking the TComponentAggregator
instance that wraps your TComponent
.