From 4a75936f974a4260943bb8cf3de9a63aabf046bb Mon Sep 17 00:00:00 2001 From: Nodir Temirkhodjaev Date: Thu, 3 Jun 2021 17:24:19 +0300 Subject: [PATCH] UI: IocContainer: Don't delete TlsIndex. Several unit tests can run in parallel. --- src/tests/UtilTest/tst_ioccontainer.h | 2 ++ src/ui/util/ioc/ioccontainer.cpp | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/tests/UtilTest/tst_ioccontainer.h b/src/tests/UtilTest/tst_ioccontainer.h index 1cb5307a..3c3f18bd 100644 --- a/src/tests/UtilTest/tst_ioccontainer.h +++ b/src/tests/UtilTest/tst_ioccontainer.h @@ -88,8 +88,10 @@ TEST_F(IocContainerTest, insert) container.setService(b); ASSERT_EQ(container.resolve(), a2); + ASSERT_EQ(container.resolve(), &b); ASSERT_TRUE(container.pinToThread()); ASSERT_EQ(IoC(), a2); + ASSERT_EQ(IoC(), &b); } TEST_F(IocContainerTest, setUp) diff --git a/src/ui/util/ioc/ioccontainer.cpp b/src/ui/util/ioc/ioccontainer.cpp index a29de0dd..d4aa39de 100644 --- a/src/ui/util/ioc/ioccontainer.cpp +++ b/src/ui/util/ioc/ioccontainer.cpp @@ -22,6 +22,7 @@ void createTlsIndex() } } +#if 0 void deleteTlsIndex() { if (g_tlsIndex != -1) { @@ -29,6 +30,7 @@ void deleteTlsIndex() g_tlsIndex = -1; } } +#endif } @@ -37,8 +39,6 @@ IocContainer::IocContainer(QObject *parent) : QObject(parent) { } IocContainer::~IocContainer() { autoDeleteAll(); - - deleteTlsIndex(); } void IocContainer::setObject(int typeId, IocObject *obj, quint8 flags)