X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/14f355c2b5c71fc7c3d680aea366582d2ac60f7b..77a1771911ed222ba6861ead327c3735fc16a0b1:/src/common/module.cpp diff --git a/src/common/module.cpp b/src/common/module.cpp index 70334f639d..961d478d93 100644 --- a/src/common/module.cpp +++ b/src/common/module.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: module.cpp +// Name: src/common/module.cpp // Purpose: Modules initialization/destruction // Author: Wolfram Gloger/adapted by Guilhem Lavaux // Modified by: @@ -9,22 +9,26 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) -#pragma implementation "module.h" -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" #ifdef __BORLANDC__ -#pragma hdrstop + #pragma hdrstop #endif #include "wx/module.h" -#include "wx/hash.h" + +#ifndef WX_PRECOMP + #include "wx/hash.h" + #include "wx/intl.h" + #include "wx/log.h" +#endif + #include "wx/listimpl.cpp" -WX_DEFINE_LIST(wxModuleList); +#define TRACE_MODULE _T("module") + +WX_DEFINE_LIST(wxModuleList) IMPLEMENT_CLASS(wxModule, wxObject) @@ -54,8 +58,10 @@ void wxModule::RegisterModules() { classInfo = (wxClassInfo *)node->GetData(); if ( classInfo->IsKindOf(CLASSINFO(wxModule)) && - (classInfo != (& (wxModule::sm_classwxModule))) ) + (classInfo != (& (wxModule::ms_classInfo))) ) { + wxLogTrace(TRACE_MODULE, wxT("Registering module %s"), + classInfo->GetClassName()); wxModule* module = (wxModule *)classInfo->CreateObject(); RegisterModule(module); } @@ -69,8 +75,12 @@ bool wxModule::InitializeModules() wxModuleList::compatibility_iterator node; for ( node = m_modules.GetFirst(); node; node = node->GetNext() ) { - if ( !node->GetData()->Init() ) + wxModule *module = node->GetData(); + if ( !module->Init() ) { + wxLogError(_("Module \"%s\" initialization failed"), + module->GetClassInfo()->GetClassName()); + // clean up already initialized modules - process in reverse order wxModuleList::compatibility_iterator n; for ( n = node->GetPrevious(); n; n = n->GetPrevious() ) @@ -78,11 +88,11 @@ bool wxModule::InitializeModules() n->GetData()->OnExit(); } - return FALSE; + return false; } } - return TRUE; + return true; } void wxModule::CleanUpModules() @@ -91,9 +101,10 @@ void wxModule::CleanUpModules() wxModuleList::compatibility_iterator node; for ( node = m_modules.GetFirst(); node; node = node->GetNext() ) { + wxLogTrace(TRACE_MODULE, wxT("Cleanup module %s"), + node->GetData()->GetClassInfo()->GetClassName()); node->GetData()->Exit(); } WX_CLEAR_LIST(wxModuleList, m_modules); } -