mirror of
https://github.com/tnodir/fort
synced 2024-11-15 07:15:39 +00:00
UI: IocContainer: Tear down in reverse order of setup
This commit is contained in:
parent
22e50a03b8
commit
8d0e946309
@ -44,8 +44,9 @@ void IocContainer::setUpAll()
|
||||
|
||||
void IocContainer::tearDownAll()
|
||||
{
|
||||
for (int i = 0; i < m_size; ++i) {
|
||||
tearDown(i);
|
||||
int i = m_setupIndex;
|
||||
while (--i >= 0) {
|
||||
tearDown(m_objectSetupIds[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,6 +64,7 @@ IocService *IocContainer::setUp(int typeId)
|
||||
const quint8 flags = m_objectFlags[typeId];
|
||||
if ((flags & (IsService | WasSetUp)) == IsService) {
|
||||
m_objectFlags[typeId] = (flags | WasSetUp);
|
||||
m_objectSetupIds[m_setupIndex++] = typeId;
|
||||
|
||||
obj->setUp();
|
||||
}
|
||||
|
@ -109,8 +109,10 @@ private:
|
||||
static ThreadStorage g_threadStorage;
|
||||
|
||||
int m_size = 0;
|
||||
int m_setupIndex = 0;
|
||||
|
||||
quint8 m_objectFlags[IOC_MAX_SIZE] = {};
|
||||
quint16 m_objectSetupIds[IOC_MAX_SIZE] = {};
|
||||
IocObject *m_objects[IOC_MAX_SIZE] = {};
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user