From: Václav Slavík Date: Thu, 5 Feb 2004 10:38:01 +0000 (+0000) Subject: restored wxPluginLibrary::ms_classes handling code that was removed by mistake X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/2d4957f2401a8814f90cda21ef945d99bc74596e?ds=inline restored wxPluginLibrary::ms_classes handling code that was removed by mistake git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25515 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/dynload.h b/include/wx/dynload.h index 1484964048..8f119b49bb 100644 --- a/include/wx/dynload.h +++ b/include/wx/dynload.h @@ -93,6 +93,8 @@ private: size_t m_objcount; // ..and (pluggable) object instantiations. wxModuleList m_wxmodules; // any wxModules that we initialised. + void UpdateClasses(); // Update ms_classes + void RestoreClasses(); // Removes this library from ms_classes void RegisterModules(); // Init any wxModules in the lib. void UnregisterModules(); // Cleanup any wxModules we installed. diff --git a/src/common/dynload.cpp b/src/common/dynload.cpp index ebff36b860..80d809e528 100644 --- a/src/common/dynload.cpp +++ b/src/common/dynload.cpp @@ -87,6 +87,7 @@ wxPluginLibrary::wxPluginLibrary(const wxString &libname, int flags) if( m_handle != 0 ) { + UpdateClasses(); RegisterModules(); } else @@ -101,6 +102,7 @@ wxPluginLibrary::~wxPluginLibrary() if( m_handle != 0 ) { UnregisterModules(); + RestoreClasses(); } } @@ -131,6 +133,27 @@ bool wxPluginLibrary::UnrefLib() // Private methods // ------------------------ +void wxPluginLibrary::UpdateClasses() +{ + for (wxClassInfo *info = m_after; info != m_before; info = info->m_next) + { + if( info->m_className ) + { + // Hash all the class names into a local table too so + // we can quickly find the entry they correspond to. + (*ms_classes)[info->m_className] = this; + } + } +} + +void wxPluginLibrary::RestoreClasses() +{ + for(wxClassInfo *info = m_after; info != m_before; info = info->m_next) + { + ms_classes->erase(ms_classes->find(info->m_className)); + } +} + void wxPluginLibrary::RegisterModules() { // Plugin libraries might have wxModules, Register and initialise them if