Skip to content

Commit 2bb4861

Browse files
committed
Fix AV in IOC for Singleton non-interfaced class
A non-interfaced class registered in the IOC as Singleton, was raising an AV when the container was freed
1 parent 767356c commit 2bb4861

File tree

2 files changed

+419
-234
lines changed

2 files changed

+419
-234
lines changed

Quick.IOC.pas

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,9 @@ destructor TIocRegistrator.Destroy;
442442
if fDependencyOrder[i] <> nil then
443443
begin
444444
//free singleton instances not interfaced
445-
if (fDependencyOrder[i] is TIocRegistrationInstance) and (TIocRegistrationInstance(fDependencyOrder[i]).IsSingleton) then TIocRegistrationInstance(regs[i]).Instance.Free;
445+
if (fDependencyOrder[i] is TIocRegistrationInstance) and
446+
(TIocRegistrationInstance(fDependencyOrder[i]).IsSingleton) then
447+
TIocRegistrationInstance(fDependencyOrder[i]).Instance.Free;
446448
fDependencyOrder[i].Free;
447449
end;
448450
end;

0 commit comments

Comments
 (0)