+ if ( !module->Init() )
+ {
+ wxLogError(_("Module \"%s\" initialization failed"),
+ module->GetClassInfo()->GetClassName());
+ return false;
+ }
+
+ wxLogTrace(TRACE_MODULE, wxT("Module \"%s\" initialized"),
+ module->GetClassInfo()->GetClassName());
+
+ module->m_state = State_Initialized;
+ initializedModules.Append(module);
+
+ return true;
+}
+
+// Initialize user-defined modules
+bool wxModule::InitializeModules()
+{
+ wxModuleList initializedModules;
+
+ for ( wxModuleList::compatibility_iterator node = m_modules.GetFirst();
+ node;
+ node = node->GetNext() )
+ {
+ wxModule *module = node->GetData();
+
+ // the module could have been already initialized as dependency of
+ // another one
+ if ( module->m_state == State_Registered )
+ {
+ if ( !DoInitializeModule( module, initializedModules ) )
+ {
+ // failed to initialize all modules, so clean up the already
+ // initialized ones
+ DoCleanUpModules(initializedModules);
+
+ return false;
+ }
+ }
+ }
+
+ // remember the real initialisation order
+ m_modules = initializedModules;
+