浏览代码

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
jkour 2 年之前
父节点
当前提交
2bb48614b9
共有 2 个文件被更改,包括 69 次插入15 次删除
  1. 3 1
      Quick.IOC.pas
  2. 66 14
      samples/delphi/QuickIOC/IOCdemo.dproj

+ 3 - 1
Quick.IOC.pas

@@ -442,7 +442,9 @@ begin
     if fDependencyOrder[i] <> nil then
     begin
       //free singleton instances not interfaced
-      if (fDependencyOrder[i] is TIocRegistrationInstance) and (TIocRegistrationInstance(fDependencyOrder[i]).IsSingleton) then TIocRegistrationInstance(regs[i]).Instance.Free;
+      if (fDependencyOrder[i] is TIocRegistrationInstance) and
+          (TIocRegistrationInstance(fDependencyOrder[i]).IsSingleton) then
+            TIocRegistrationInstance(fDependencyOrder[i]).Instance.Free;
       fDependencyOrder[i].Free;
     end;
   end;

文件差异内容过多而无法显示
+ 66 - 14
samples/delphi/QuickIOC/IOCdemo.dproj


部分文件因为文件数量过多而无法显示