diff --git a/typo3/sysext/backend/Classes/Form/FormDataProvider/AbstractItemProvider.php b/typo3/sysext/backend/Classes/Form/FormDataProvider/AbstractItemProvider.php
index 41b232a9ba3e012f395e5fb5882c3d3df1a2cb87..d8a6a12f6dce6a6e0c6a3f3652ed9d31a0d0ba8a 100644
--- a/typo3/sysext/backend/Classes/Form/FormDataProvider/AbstractItemProvider.php
+++ b/typo3/sysext/backend/Classes/Form/FormDataProvider/AbstractItemProvider.php
@@ -520,6 +520,7 @@ abstract class AbstractItemProvider
         }
 
         $fileRepository = GeneralUtility::makeInstance(FileRepository::class);
+        $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
 
         while ($foreignRow = $queryResult->fetch()) {
             BackendUtility::workspaceOL($foreignTable, $foreignRow);
@@ -546,7 +547,6 @@ abstract class AbstractItemProvider
                     }
                 } else {
                     // Else, determine icon based on record type, or a generic fallback
-                    $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
                     $icon = $iconFactory->mapRecordTypeToIconIdentifier($foreignTable, $foreignRow);
                 }
                 // Add the item
diff --git a/typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/TcaSelectTreeItemsTest.php b/typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/TcaSelectTreeItemsTest.php
index 6f78134380397ad20af89ce2a641f4dd50552fcd..d0e7c5f9d6990995bdb4dde36a81cbef2ed42ae2 100644
--- a/typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/TcaSelectTreeItemsTest.php
+++ b/typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/TcaSelectTreeItemsTest.php
@@ -121,6 +121,7 @@ class TcaSelectTreeItemsTest extends UnitTestCase
 
         $iconFactoryProphecy = $this->prophesize(IconFactory::class);
         GeneralUtility::addInstance(IconFactory::class, $iconFactoryProphecy->reveal());
+        GeneralUtility::addInstance(IconFactory::class, $iconFactoryProphecy->reveal());
 
         $fileRepositoryProphecy = $this->prophesize(FileRepository::class);
         $fileRepositoryProphecy->findByRelation(Argument::cetera())->shouldNotBeCalled();
@@ -191,6 +192,7 @@ class TcaSelectTreeItemsTest extends UnitTestCase
 
         $iconFactoryProphecy = $this->prophesize(IconFactory::class);
         GeneralUtility::addInstance(IconFactory::class, $iconFactoryProphecy->reveal());
+        GeneralUtility::addInstance(IconFactory::class, $iconFactoryProphecy->reveal());
 
         $fileRepositoryProphecy = $this->prophesize(FileRepository::class);
         $fileRepositoryProphecy->findByRelation(Argument::cetera())->shouldNotBeCalled();