File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -467,9 +467,15 @@ destructor TIocRegistrator.Destroy;
467467 if fDependencyOrder[i] <> nil then
468468 begin
469469 // free singleton instances not interfaced
470- if (fDependencyOrder[i] is TIocRegistrationInstance) and
471- (TIocRegistrationInstance(fDependencyOrder[i]).IsSingleton) then
472- TIocRegistrationInstance(fDependencyOrder[i]).Instance.Free;
470+ if (fDependencyOrder[i] is TIocRegistrationInstance) and
471+ (TIocRegistrationInstance(fDependencyOrder[i]).IsSingleton) then
472+ TIocRegistrationInstance(fDependencyOrder[i]).Instance.Free
473+ else
474+ // free singleton instances interfaced
475+ if (fDependencyOrder[i] is TIocRegistrationInterface) and
476+ (TIocRegistrationInterface(fDependencyOrder[i]).IsSingleton) and
477+ (Assigned(TIocRegistrationInterface(fDependencyOrder[i]).Instance)) then
478+ TIocRegistrationInterface(fDependencyOrder[i]).Instance._Release;
473479 fDependencyOrder[i].Free;
474480 end ;
475481 end ;
You can’t perform that action at this time.
0 commit comments