Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions Quick.IOC.pas
Original file line number Diff line number Diff line change
Expand Up @@ -467,9 +467,15 @@ destructor TIocRegistrator.Destroy;
if fDependencyOrder[i] <> nil then
begin
//free singleton instances not interfaced
if (fDependencyOrder[i] is TIocRegistrationInstance) and
(TIocRegistrationInstance(fDependencyOrder[i]).IsSingleton) then
TIocRegistrationInstance(fDependencyOrder[i]).Instance.Free;
if (fDependencyOrder[i] is TIocRegistrationInstance) and
(TIocRegistrationInstance(fDependencyOrder[i]).IsSingleton) then
TIocRegistrationInstance(fDependencyOrder[i]).Instance.Free
else
//free singleton instances interfaced
if (fDependencyOrder[i] is TIocRegistrationInterface) and
(TIocRegistrationInterface(fDependencyOrder[i]).IsSingleton) and
(Assigned(TIocRegistrationInterface(fDependencyOrder[i]).Instance)) then
TIocRegistrationInterface(fDependencyOrder[i]).Instance._Release;
fDependencyOrder[i].Free;
end;
end;
Expand Down