X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/644cb5372c67d2bd246729257b936bd0aa85b882..e5ef1cae0f424be0bffbd651cb10052dfb208396:/src/common/module.cpp diff --git a/src/common/module.cpp b/src/common/module.cpp index 9f867b4c25..230b8aa577 100644 --- a/src/common/module.cpp +++ b/src/common/module.cpp @@ -79,6 +79,10 @@ bool wxModule::DoInitializeModule(wxModule *module, module->m_state = State_Initializing; + // translate named dependencies to the normal ones first + if ( !module->ResolveNamedDependencies() ) + return false; + const wxArrayClassInfo& dependencies = module->m_dependencies; // satisfy module dependencies by loading them before the current module @@ -197,3 +201,25 @@ void wxModule::DoCleanUpModules(const wxModuleList& modules) // 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; +}