+// Clean up all currently initialized modules
+void wxModule::DoCleanUpModules(const wxModuleList& modules)
+{
+ // cleanup user-defined modules in the reverse order compared to their
+ // initialization -- this ensures that dependencies are respected
+ for ( wxModuleList::compatibility_iterator node = modules.GetLast();
+ node;
+ node = node->GetPrevious() )
+ {
+ wxLogTrace(TRACE_MODULE, wxT("Cleanup module %s"),
+ node->GetData()->GetClassInfo()->GetClassName());
+
+ wxModule * module = node->GetData();
+
+ wxASSERT_MSG( module->m_state == State_Initialized,
+ wxT("not initialized module being cleaned up") );
+
+ module->Exit();
+ module->m_state = State_Registered;
+ }
+
+ // clear all modules, even the non-initialized ones
+ WX_CLEAR_LIST(wxModuleList, m_modules);
+}
+
+bool wxModule::ResolveNamedDependencies()
+{
+ // first resolve required dependencies
+ for ( size_t i = 0; i < m_namedDependencies.size(); ++i )
+ {
+ wxClassInfo *info = wxClassInfo::FindClass(m_namedDependencies[i]);
+
+ if ( !info )
+ {
+ // required dependency not found
+ return false;
+ }
+
+ // add it even if it is not derived from wxModule because
+ // DoInitializeModule() will make sure a module with the same class
+ // info exists and fail if it doesn't
+ m_dependencies.Add(info);
+ }
+
+ return true;
+}