- Timestamp:
- Dec 2, 2015, 11:22:03 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/cpp11_v2/src/libraries/core/CoreStaticInitializationHandler.cc
r10821 r10916 99 99 std::set<Identifier*> identifiers; 100 100 const std::set<StaticallyInitializedInstance*>& instances = module->getInstances(StaticInitialization::IDENTIFIER); 101 for ( const auto &instance : instances)101 for (StaticallyInitializedInstance* instance : instances) 102 102 identifiers.insert(&static_cast<StaticallyInitializedIdentifier*>(instance)->getIdentifier()); 103 103 … … 106 106 // that objects within one module may reference each other by strong pointers. but it is not allowed that objects from another 107 107 // module (which is not unloaded) uses strong pointers to point at objects inside the unloaded module. this will lead to a crash. 108 for ( const auto &identifier : identifiers)109 (identifier)->destroyObjects();108 for (Identifier* identifier : identifiers) 109 identifier->destroyObjects(); 110 110 111 111 // check if all objects were really destroyed. this is not the case if an object is referenced by a strong pointer from another 112 112 // module (or if two objects inside this module reference each other). this will lead to a crash and must be fixed (e.g. by 113 113 // changing object dependencies; or by changing the logic that allows modules to be unloaded). 114 for ( const auto &identifier : identifiers)114 for (Identifier* identifier : identifiers) 115 115 { 116 116 ObjectListBase* objectList = Context::getRootContext()->getObjectList(identifier); 117 117 if (objectList->size() > 0) 118 118 { 119 orxout(internal_error) << "There are still " << objectList->size() << " objects of type " << (identifier)->getName()119 orxout(internal_error) << "There are still " << objectList->size() << " objects of type " << identifier->getName() 120 120 << " after unloading the Identifier. This may lead to a crash" << endl; 121 121 } … … 123 123 124 124 // destroy object-lists in all contexts 125 for ( const auto &identifier : identifiers)125 for (Identifier* identifier : identifiers) 126 126 { 127 127 // only do this if the Identifier is not a Context itself; otherwise we delete the list we're iterating over 128 if (! (identifier)->isExactlyA(Class(Context)))128 if (!identifier->isExactlyA(Class(Context))) 129 129 { 130 130 // iterate over all contexts 131 131 for (ObjectList<Context>::iterator it_context = ObjectList<Context>::begin(); it_context != ObjectList<Context>::end(); ++it_context) 132 it_context->destroyObjectList( (identifier));132 it_context->destroyObjectList(identifier); 133 133 } 134 134 }
Note: See TracChangeset
for help on using the changeset viewer.